go-chat

command module
v0.0.0-...-29cdc53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 5 Imported by: 0

README

TCP Chat Server with Go Std Lib

Description

This project is a simple TCP chat server implemented in Go using standard library. It features handling of client connections, message broadcasting, rate limiting, and client banning based on strike counts. The server operates over TCP and provides basic chat functionality.

Features

  • TCP-based communication
  • Handling multiple client connections
  • Broadcasting messages to all connected clients
  • Rate limiting to prevent spam
  • Strike-based banning mechanism
  • Configurable settings

Getting Started

Prerequisites
  • Go (written and tested in 1.21.x)
Installation
  1. Clone the repository:
git clone https://github.com/akshaysangma/go-chat.git 
  1. Navigate to the project directory:
cd go-chat
Configuration

The server configuration can be adjusted via the following constants in the main Go file:

  • Port: The port on which the server listens.
  • MsgBufferSize: Size of the message buffer.
  • DebugMode: Enables or disables debug mode.
  • RateLimit: Duration for rate limiting messages (in seconds).
  • StrikeCount: Number of strikes before banning a client.
  • BanTimeout: Duration for which a client is banned (in minutes).
Running the Server

To start the server, run:

go run main.go

Usage

Once the server is running, clients can connect to it using any TCP client at the specified port. Messages sent by a client will be broadcast to all other connected clients. Example with Telnet

telnet localhost 8125

Contributing

Contributions to the project are welcome. Please follow the standard Git workflow - fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL