Documentation
¶
Index ¶
- func GenerateRandomB32String(length int) (string, error)
- func GenerateRandomBytes(length int) ([]byte, error)
- func GetEnv(key string, def string) string
- func InitLogging()
- func LoadConfigFromPath(path string, config interface{}) interface{}
- func WaitForSigIntAndQuit()
- type GameDefinition
- type GameIDType
- type HostPolicy
- type SerializableDuration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomB32String ¶
GenerateRandomB32String returns a base32-encoded string of `length` random bytes.
func GenerateRandomBytes ¶
GenerateRandomBytes returns an array of `length` random bytes.
func LoadConfigFromPath ¶
func LoadConfigFromPath(path string, config interface{}) interface{}
LoadConfigFromPath loads an arbitrary object from JSON data specified by the given path.
func WaitForSigIntAndQuit ¶
func WaitForSigIntAndQuit()
WaitForSigIntAndQuit blocks until a SIGINT is received and then exits the program.
Types ¶
type GameDefinition ¶
type GameDefinition struct { GameID GameIDType `json:"gameId"` HostPolicy HostPolicy `json:"hostPolicy"` }
GameDefinition defines a specific game supported by a hotel server cluster, identified by a game ID, along with policies on how the game is managed.
type GameIDType ¶
type GameIDType string
GameIDType is a unique ID for a game type, so hotel can multiplex across games.
type HostPolicy ¶
type HostPolicy int
HostPolicy determines how the game is allowed to be hosted/started by clients.
const ( // HostPolicy_DISABLED means new servers may not be hosted or spawned by regular clients. // They can only be hosted by privileged clients (server owners). HostPolicy_DISABLED HostPolicy = iota // HostPolicy_CLIENTS_ONLY means new servers can be hosted and registered by any client, // but clients cannot request new instances to be spawned. HostPolicy_CLIENTS_ONLY // HostPolicy_SPAWN_ONLY means new servers can be spawn requested, but arbitrary servers // cannot be hosted/registered. HostPolicy_SPAWN_ONLY // HostPolicy_ANY means new servers can be hosted by any client as well as requested to be spawned. HostPolicy_ANY )
func (*HostPolicy) UnmarshalJSON ¶
func (hp *HostPolicy) UnmarshalJSON(data []byte) error
UnmarshalJSON fills the instance from JSON data.
type SerializableDuration ¶
SerializableDuration is a Duration type which can be serialized to/from JSON.
func (*SerializableDuration) UnmarshalJSON ¶
func (sd *SerializableDuration) UnmarshalJSON(data []byte) error
UnmarshalJSON fills the instance from JSON data.