Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Connections that are not yet authenticated. GuestClients = &ClientConnectionsList[ClientAddr]{ list: make(map[ClientAddr]*quic.Conn), } // Connections that have successfully authenticated, keyed by their public key. AuthenticatedClients = &ClientConnectionsList[PublicKey]{ list: make(map[PublicKey]*quic.Conn), } )
Global instances of our connection lists with specific types.
View Source
var Delimiter = []byte("\n\r\n\r")
Functions ¶
func GenerateTLSConfig ¶
Creates a self-signed TLS configuration.
func HandleConnection ¶
func InitServer ¶
func InitServer() error
Types ¶
type ClientAddr ¶
type ClientAddr string
Define specific types for identifiers to improve code clarity and safety.
type ClientConnectionsList ¶
type ClientConnectionsList[T ClientAddr | PublicKey] struct { sync.RWMutex // contains filtered or unexported fields }
A thread-safe map for managing client connections.
func (*ClientConnectionsList[T]) Add ¶
func (c *ClientConnectionsList[T]) Add(identifier T, conn *quic.Conn)
Add safely adds a new client connection to the list.
func (*ClientConnectionsList[T]) Remove ¶
func (c *ClientConnectionsList[T]) Remove(identifier T)
Remove safely removes a client connection from the list.
func (*ClientConnectionsList[T]) RemoveByConnection ¶
func (c *ClientConnectionsList[T]) RemoveByConnection(conn *quic.Conn)
RemoveByConnection safely removes a client by their connection object.
Click to show internal directories.
Click to hide internal directories.