Documentation ¶
Index ¶
- Variables
- func AddObjectToTable(room string, object *TableObject) error
- func CloseCaches()
- func CloseSession(sessionId string) bool
- func CreateRoom(roomId string, data string)
- func DeleteConnection(connId string)
- func DeleteRoom(roomID string)
- func EnterUDP(roomID string, connectionId string, clientId string, addr *net.UDPAddr, ...) bool
- func ForwardGameEvent(sessionId string, event games.EventContext) bool
- func GetAllAdapters(room string) ([]string, bool)
- func GetSession(sessionId string) (games.GameSession, bool)
- func JoinRoom(roomID string, connectionId string) bool
- func JoinSession(connId string, sessionId string) bool
- func JoinTable(room string, client string) error
- func LeaveTable(room string, client string) error
- func ModifyTableObject(room string, objectId string, data string, width float64, height float64) error
- func MoveTableObject(room string, objectId string, x, y float64) error
- func OpenGameSession(connId string, clientId string, roomId string, gameId string) (games.GameSession, bool)
- func RemoveMember(roomID string, connectionId string) bool
- func RemoveObjectFromTable(room string, object string) error
- func RotateTableObject(room string, objectId string, rotation float64) error
- func SaveConnections(roomId string, connections RoomConnections) bool
- func SelectTableObject(room string, objectId string, client string) error
- func SetGameState(sessionId string, state int) (games.GameSession, bool)
- func SetMemberData(roomID string, connectionId string, clientId string, data string) bool
- func SetRoomData(roomID string, data string) bool
- func SetupMemory()
- func StartGameSession(sessionId string) bool
- func TableMembers(room string) (bool, []string)
- func TestRooms(t *testing.T)
- type Connection
- type ReturnableMember
- type Room
- type RoomConnection
- type RoomConnections
- type TableData
- type TableObject
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTableNotFound = errors.New("table not found") ErrClientAlreadyJoinedTable = errors.New("client already joined table") ErrCouldntCreateTable = errors.New("couldn't create table") ErrObjectNotFound = errors.New("one table object wasn't found") )
Errors
View Source
var GamesMap = map[string]games.Game{}
View Source
var SSInstance *pipeshandler.Instance
View Source
var SSNode *pipes.LocalNode
Functions ¶
func AddObjectToTable ¶
func AddObjectToTable(room string, object *TableObject) error
* Object helpers
func CloseCaches ¶
func CloseCaches()
func CloseSession ¶
func CreateRoom ¶
CreateRoom creates a room in the cache
func DeleteConnection ¶
func DeleteConnection(connId string)
TODO: Create a test for all deletion functions
func EnterUDP ¶
func EnterUDP(roomID string, connectionId string, clientId string, addr *net.UDPAddr, key *[]byte) bool
JoinRoom adds a member to a room in the cache
func ForwardGameEvent ¶
func ForwardGameEvent(sessionId string, event games.EventContext) bool
func GetAllAdapters ¶
Get all adapters from a room
func GetSession ¶
func GetSession(sessionId string) (games.GameSession, bool)
func JoinSession ¶
func LeaveTable ¶
func ModifyTableObject ¶
func OpenGameSession ¶
func RemoveMember ¶
func RemoveObjectFromTable ¶
func RotateTableObject ¶
func SaveConnections ¶
func SaveConnections(roomId string, connections RoomConnections) bool
Save changes in a room
func SetGameState ¶
func SetGameState(sessionId string, state int) (games.GameSession, bool)
func SetMemberData ¶
Sets the member data
func SetRoomData ¶
func SetupMemory ¶
func SetupMemory()
func StartGameSession ¶
func TableMembers ¶
Types ¶
type Connection ¶
type Connection struct { ID string Room string ClientID string CurrentSession string UDP *net.UDPAddr Key []byte Cipher cipher.Block }
func EmptyConnection ¶
func EmptyConnection(connId string, room string) Connection
func GetConnection ¶
func GetConnection(connId string) (Connection, bool)
func VerifyUDP ¶
packetHash = encrypted hash included in the packet by the client hash = computed hash of the packet
func (*Connection) KeyBase64 ¶
func (c *Connection) KeyBase64() string
type ReturnableMember ¶
type ReturnableMember struct { ID string `json:"id"` // Syntax: data:clientID Muted bool `json:"muted"` Deafened bool `json:"deafened"` }
TODO: Implement as standard
type Room ¶
type RoomConnection ¶
type RoomConnection struct { Connected bool Connection *net.UDPAddr Adapter string Key *[]byte ClientID string CurrentSession string Data string //* Client status Muted bool Deafened bool }
func (*RoomConnection) ToReturnableMember ¶
func (r *RoomConnection) ToReturnableMember() ReturnableMember
type RoomConnections ¶
type RoomConnections map[string]RoomConnection
Member (Connection) ID -> Connections
func GetAllConnections ¶
func GetAllConnections(room string) (RoomConnections, bool)
Get all connections from a room
type TableData ¶
type TableObject ¶
type TableObject struct { ID string `json:"id"` LocationX float64 `json:"x"` LocationY float64 `json:"y"` Width float64 `json:"w"` Height float64 `json:"h"` Rotation float64 `json:"r"` Type int `json:"t"` Creator string `json:"cr"` // ID of the creator Holder string `json:"ho"` // ID of the current card holder (others can't move/modify it while it's held) Data string `json:"d"` // Encrypted }
func GetTableObject ¶
func GetTableObject(room string, objectId string) (*TableObject, bool)
func TableObjects ¶
func TableObjects(room string) ([]*TableObject, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.