Skip to content

AdrianUrc/TCP-TLS_ChatServer

Repository files navigation

TCP-TLS_ChatServer:

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.

MAIN FEATURES:

  • 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.

REQUIREMENTS:

  • Cargo package manager for compiling Rust.
  • OpenSSL to generate the autosigned certificate and private key, and for connecting to the server.

SETTING UP (GUIDE):

  1. Clone the Github repository on your PC: git clone https://github.com/AdrianUrc/TCP-TLS_ChatServer.git
  2. Compile the project with Cargo: cargo check
  3. 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:2048
    • openssl req -new -x509 -key key.pem -out cert.pem -days 365 (It doesn't matters what you respond for the questions in this command)
  4. Generate the binary file: cargo build --release (Optional)
  5. If you don't want to create a binary you can just run It by: cargo run

CONNECTING TO THE CHAT SERVER:

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.

READ BEFORE USING:

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.

CHATSERVER IMAGES

NULL NULL NULL NULL

About

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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages