package cache import ( "sync" "sync/atomic" "github.com/gorilla/websocket" ) type Cache struct { mu sync.Mutex state atomic.Pointer[mappings] } type ConnectionCache struct { mu sync.Mutex state atomic.Pointer[connectionMappings] } type mappings struct { s2c map[string]string c2s map[string]string } type connectionMappings struct { id2c map[string]*conn } type ConnectionMetaData struct { ConnectionType string // "mod" or "bot" ID string // server_id or bot_id for logging } type conn struct { connection *websocket.Conn meta *ConnectionMetaData }