Documentation ¶
Index ¶
- Variables
- func JSONDump(message any) []byte
- func MulticastMessage(clients map[uuid.UUID]*Client, message []byte, ignoreOrigin *Client)
- func MulticastMessageArray(clients []*Client, message []byte, ignoreOrigin *Client)
- func New(manager *Manager, con *websocket.Conn)
- func NewHost(lobbyID string, client *Client, manager *Manager, AllowHostReclaim bool, ...) bool
- func NewPeer(lobbyID string, client *Client, manager *Manager) bool
- func NotifyPeersOfStateChange(eventType int, lobbyID string, manager *Manager, client *Client)
- func Remove(manager *Manager)
- func SessionCleanup(manager *Manager, client *Client)
- func SignalingOpcode(message []byte, manager *Manager, client *Client)
- func UnicastMessage(client *Client, message []byte, ignoreOrigin *Client)
- type ChannelConfig
- type ChannelDetails
- type Client
- type HostConfig
- type HostDetails
- type Lobby
- type Manager
- func (manager *Manager) AbandonLobbies(client *Client)
- func (manager *Manager) AcquireAccessLock(lock *sync.RWMutex, something string)
- func (manager *Manager) AddClient(client *Client)
- func (manager *Manager) BroadcastDiscovery(lobbyID string, Host *Client, Peer *Client)
- func (manager *Manager) FreeAccessLock(lock *sync.RWMutex, something string)
- func (manager *Manager) RemoveClient(client *Client)
- type Packet
- type PacketHost
- type PacketPeer
- type PeerConfig
- type PeerDetails
- type ReclaimHost
- type ReclaimHostConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var Managers = map[string]*Manager{}
View Source
var Opcodes = map[string]int{
"VIOLATION": 0,
"KEEPALIVE": 1,
"INIT": 2,
"INIT_OK": 3,
"CONFIG_HOST": 4,
"CONFIG_PEER": 5,
"ACK_HOST": 6,
"ACK_PEER": 7,
"NEW_HOST": 8,
"NEW_PEER": 9,
"MAKE_OFFER": 10,
"MAKE_ANSWER": 11,
"ICE": 12,
"ABORT_OFFER": 13,
"ABORT_ANSWER": 14,
"SHUTDOWN": 15,
"LOBBY_EXISTS": 16,
"LOBBY_NOTFOUND": 17,
"LOBBY_FULL": 18,
"LOBBY_LOCKED": 19,
"LOBBY_CLOSE": 20,
"HOST_GONE": 21,
"PEER_GONE": 22,
"HOST_RECLAIM": 23,
"CLAIM_HOST": 24,
"TRANSFER_HOST": 25,
"ABANDON": 26,
"LOCK": 27,
"UNLOCK": 28,
"SIZE": 29,
"KICK": 30,
"PASSWORD_REQUIRED": 31,
"PASSWORD_ACK": 32,
"PASSWORD_FAIL": 33,
"PEER_INVALID": 34,
"NEW_CHANNEL": 35,
}
See https://github.com/MikeDev101/cloudlink-omega/blob/main/backend/docs/protocol.md
View Source
var ServerVersion string = "0.1.0"
View Source
var VerboselyLogLocks bool = true
Functions ¶
func MulticastMessage ¶
MulticastMessage broadcasts a payload to multiple clients.
func MulticastMessageArray ¶
MulticastMessageArray broadcasts a payload to multiple clients.
func SessionCleanup ¶
func SignalingOpcode ¶
Handles incoming messages from the websocket server
func UnicastMessage ¶
UnicastMessageAny broadcasts a payload to a singular client.
Types ¶
type ChannelConfig ¶
type ChannelDetails ¶
type Client ¶
type Client struct { // Lock state for rooms sync.RWMutex // contains filtered or unexported fields }
func NewClient ¶
NewClient assigns a UUID to a websocket client, and returns a initialized Client struct for use with a manager's AddClient.
func (*Client) CloseConnectionOnError ¶
func (*Client) CloseWithMessage ¶
func (*Client) MessageHandler ¶
type HostConfig ¶
type HostDetails ¶
type Manager ¶
type Manager struct { // Friendly Name for manager Name string // Locks states before registering sessions sync.RWMutex // contains filtered or unexported fields }
func NewManager ¶
func (*Manager) AbandonLobbies ¶
func (*Manager) AcquireAccessLock ¶
Verbosely log RWMutex lock requests
func (*Manager) BroadcastDiscovery ¶
Loop through all peers in a lobby, notify peer (*Client) of all other peers ([]*Peer) while excluding host (*Client) and itself (*Client)
func (*Manager) FreeAccessLock ¶
Verbosely log RWMutex unlock requests
func (*Manager) RemoveClient ¶
type Packet ¶
type Packet struct { Opcode int `json:"opcode"` Payload interface{} `json:"payload,omitempty"` Tx *PeerDetails `json:"tx,omitempty"` Rx string `json:"rx,omitempty"` }
type PacketHost ¶
type PacketHost struct { Opcode int `json:"opcode"` Payload *HostDetails `json:"payload"` }
type PacketPeer ¶
type PacketPeer struct { Opcode int `json:"opcode"` Payload *PeerDetails `json:"payload"` }
type PeerConfig ¶
type PeerDetails ¶
type ReclaimHost ¶
type ReclaimHostConfig ¶
type ReclaimHostConfig struct { Opcode int `json:"opcode"` Payload *ReclaimHost `json:"payload"` }
Click to show internal directories.
Click to hide internal directories.