ChatServer is a fully asynchronous multi-client TCP chat server, developed in Rust with Tokio and TLS (Rustls). It provides secure communication between clients through encryption, shared state management, and real-time interactive commands.
- Secure TLS connections thanks to tokio-rustls.
- Asynchronous architecture based on Tokio and async/await.
- Multi-client support with concurrent connection handling.
- Real-time broadcasting system using tokio::sync::broadcast.
- Shared state management via Arc.
- Built-in client commands:
/exit→ exit the server./nick→ change the visible nickname./clients→ see the number of connected clients./who→ list connected users./help→ display the command manual.
- Real-time active connections counter.
- Modular design: Listener, Client, and State fully separated.
- Custom ASCII banners with author signature.
- Readable logs and traces via tracing and tracing-subscriber.
- Cargo package manager for compiling Rust.
- OpenSSL to generate the autosigned certificate and private key, and for connecting to the server.
- Clone the Github repository on your PC:
git clone https://github.com/AdrianUrc/TCP-TLS_ChatServer.git - Compile the project with Cargo:
cargo check - Generate the Certificate and the Private Key to enable TLS: (You should run this commands in the project's home directory)
openssl genpkey -algorithm RSA -out key.pem -pkeyopt rsa_keygen_bits:2048openssl req -new -x509 -key key.pem -out cert.pem -days 365(It doesn't matters what you respond for the questions in this command)
- Generate the binary file:
cargo build --release(Optional) - If you don't want to create a binary you can just run It by:
cargo run
To stablish a connection with the server it's just needed to run the command: openssl s_client -connect <HOST_IP:PORT> -quiet
- HOST_IP: it's the IP of the machine where server is running.
- PORT: if you don't do any changes on the code, the default port used is 2409.
It's not recommended to expose the ChatServer on Internet by Port-Forwarding because it doesn't implement real security against net attacks. Just try It on your local network or on a trusted network by your own responsibility.



