A recreation of the classic nc utility as a multi-client group chat, written in Go with nothing but the standard library. One TCP server, up to 10 simultaneous clients, raw sockets.
Built during my training at Zone01 Rouen.
- One goroutine per client, shared state guarded by a mutex
- Login with a unique, non-empty username (greeted by an ASCII gopher)
- Full chat history replayed to newcomers
- Every message timestamped
[YYYY-MM-DD HH:MM:SS][name]:and broadcast to all connected clients - Join and leave announcements
- Terminal escape codes keep your input line intact when a message arrives mid-typing
- Every session written to a log file in
log/ - Commands:
/rename,/list - Admin commands (user
admin):/ban,/mute,/unmute
go run . [port]
The port defaults to 8989. Then connect from any terminal:
nc localhost 8989
server.go TCP server, client lifecycle, broadcast
login.go username prompt and validation
cmd.go /rename, /list and admin commands