eod commit

This commit is contained in:
2025-12-01 22:30:36 +01:00
parent 2372da942a
commit 8f7db6256b
9 changed files with 190 additions and 84 deletions

21
util/cache/structs.go vendored
View File

@@ -3,6 +3,8 @@ package cache
import (
"sync"
"sync/atomic"
"github.com/gorilla/websocket"
)
type Cache struct {
@@ -10,7 +12,26 @@ type Cache struct {
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
}