Files
HomesteadGateway/util/cache/structs.go
2025-12-01 22:30:36 +01:00

38 lines
596 B
Go

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
}