eod commit
This commit is contained in:
21
util/cache/structs.go
vendored
21
util/cache/structs.go
vendored
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user