From 112722f1c8de842f6c8b672ea73b3cae182274ba Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 8 Dec 2024 09:49:40 +0800 Subject: Primitive nick registration --- clients.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clients.go') diff --git a/clients.go b/clients.go index 1a363cc..a181f99 100644 --- a/clients.go +++ b/clients.go @@ -3,11 +3,12 @@ package main import ( "net" "log/slog" + "sync" ) type Client struct { conn *net.Conn - UID [6]byte + UID string Nick string Ident string Host string @@ -41,7 +42,7 @@ func (client Client) ClientSource() string { } func (client Client) ServerSource() string { - return string(client.Server.SID[:]) + string(client.UID[:]) + return client.UID } type ClientState uint8 @@ -51,3 +52,6 @@ const ( ClientStatePreRegistration ClientStateRegistered ) + +var uidToClient = sync.Map{} +var nickToClient = sync.Map{} -- cgit v1.2.3