mirror repo of https://github.com/littlequartz/clink. a socket programming assignment for Sistem Terdistribusi
Go to file
Syahdan 2c884d030a feat(server): usernames, IDs, and commands; sanitize names; richer join/leave messages
- Add go-nanoid to generate 6-char per-connection IDs; fallback to RemoteAddr
- Introduce sanitizeUsername with rules: [A-Za-z0-9_.-], spaces→_, trim ._-, max 12 chars
- Support /name <username> to change username with validation and broadcast [rename]
- Greet client with default username user_<id> and usage hint for /name
- Broadcast joins/leaves and messages including username and ID; exclude self on join
- Handle /quit to trigger unified leave flow; consistent leave announcement
- Comment/document broadcast struct, Hub, and startTCPServer
- Increase scanner buffer and add newline-delimited send in broadcaster
2025-10-15 11:25:56 +07:00
go.mod feat(server): usernames, IDs, and commands; sanitize names; richer join/leave messages 2025-10-15 11:25:56 +07:00
go.sum feat(server): usernames, IDs, and commands; sanitize names; richer join/leave messages 2025-10-15 11:25:56 +07:00
main.go feat(chat): CLI flags, centered header; improve server with selective broadcast and quit handling 2025-10-15 11:25:16 +07:00
server.go feat(server): usernames, IDs, and commands; sanitize names; richer join/leave messages 2025-10-15 11:25:56 +07:00