Documentation ¶
Index ¶
- Constants
- func FindIdentity() string
- type ClientExtInfo
- type ClientKick
- type ClientLeave
- type ClientName
- type ClientNum
- type ClientPacket
- type ENetDatagram
- type GameServer
- func (s *GameServer) GetClientInfo() []*ClientExtInfo
- func (server *GameServer) GetEntities() []maps.Entity
- func (server *GameServer) GetFormattedReference() string
- func (s *GameServer) GetServerInfo() *ServerInfo
- func (s *GameServer) GetTeamInfo() *TeamInfo
- func (s *GameServer) GetUptime() int
- func (server *GameServer) IsReference(reference string) bool
- func (server *GameServer) Logger() zerolog.Logger
- func (server *GameServer) Reference() string
- func (server *GameServer) Shutdown()
- type InfoProvider
- type MapRequest
- type PingEvent
- type ServerInfo
- type ServerInfoService
- func (s *ServerInfoService) Handle(request *io.Packet, out chan []byte) error
- func (s *ServerInfoService) PollMaster(ctx context.Context, port int)
- func (s *ServerInfoService) Serve(ctx context.Context, port int, registerMaster bool) error
- func (s *ServerInfoService) Shutdown()
- func (s *ServerInfoService) UpdateMaster(port int) error
- type ServerManager
- func (manager *ServerManager) FindPreset(presetName string, isVirtualOk bool) opt.Option[config.Preset]
- func (manager *ServerManager) GetServerInfo() *ServerInfo
- func (manager *ServerManager) NewServer(ctx context.Context, presetName string, isVirtualOk bool) (*GameServer, error)
- func (manager *ServerManager) PollMapRequests(ctx context.Context, server *GameServer)
- func (manager *ServerManager) PruneServers(ctx context.Context)
- func (manager *ServerManager) ReadEntities(ctx context.Context, server *GameServer, data []byte) error
- func (manager *ServerManager) ReceiveKicks() <-chan ClientKick
- func (manager *ServerManager) ReceivePackets() <-chan ClientPacket
- func (manager *ServerManager) RemoveServer(server *GameServer)
- func (manager *ServerManager) Shutdown()
- func (manager *ServerManager) Start() error
- type ServerUptime
- type TeamInfo
- type TeamScore
Constants ¶
View Source
const ( EXT_ACK = -1 EXT_VERSION = 105 EXT_NO_ERROR = 0 EXT_ERROR = 1 EXT_PLAYERSTATS_RESP_IDS = -10 EXT_PLAYERSTATS_RESP_STATS = -11 EXT_UPTIME = 0 EXT_PLAYERSTATS = 1 EXT_TEAMSCORE = 2 )
View Source
const ( // How long we wait before pruning an unused server SERVER_MAX_IDLE_TIME = time.Duration(10 * time.Minute) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientExtInfo ¶
type ClientExtInfo struct { Client int Ping int Name string Team string Frags int32 Flags int32 Deaths int32 TeamKills int32 Damage int32 Health int32 Armour int32 GunSelect int32 Privilege int32 State int32 Ip0 byte Ip1 byte Ip2 byte }
func DecodeClientInfo ¶
func DecodeClientInfo(p io.Packet) (*ClientExtInfo, error)
type ClientLeave ¶
type ClientName ¶
type ClientNum ¶
type ClientNum int32
Sauerbraten servers assign each client a number. NOT the same thing as ClientID.
type ClientPacket ¶
type ENetDatagram ¶
type ENetDatagram struct {
// contains filtered or unexported fields
}
func NewENetDatagram ¶
func NewENetDatagram() *ENetDatagram
func (*ENetDatagram) Serve ¶
func (i *ENetDatagram) Serve(port int) error
func (*ENetDatagram) Shutdown ¶
func (i *ENetDatagram) Shutdown()
type GameServer ¶
type GameServer struct { *gameserver.Server Id string // Another way for the client to refer to this server Alias string Entities []maps.Entity // Whether this map was in our assets (ie can we send it to the client) IsBuiltMap bool Hidden bool // The last time a client connected LastEvent time.Time Started time.Time Mutex deadlock.RWMutex From *P.MessageProxy To *P.MessageProxy // contains filtered or unexported fields }
func (*GameServer) GetClientInfo ¶
func (s *GameServer) GetClientInfo() []*ClientExtInfo
func (*GameServer) GetEntities ¶
func (server *GameServer) GetEntities() []maps.Entity
func (*GameServer) GetFormattedReference ¶
func (server *GameServer) GetFormattedReference() string
func (*GameServer) GetServerInfo ¶
func (s *GameServer) GetServerInfo() *ServerInfo
func (*GameServer) GetTeamInfo ¶
func (s *GameServer) GetTeamInfo() *TeamInfo
func (*GameServer) GetUptime ¶
func (s *GameServer) GetUptime() int
func (*GameServer) IsReference ¶
func (server *GameServer) IsReference(reference string) bool
Whether this string is a reference to this server (either an alias or an id).
func (*GameServer) Logger ¶
func (server *GameServer) Logger() zerolog.Logger
func (*GameServer) Reference ¶
func (server *GameServer) Reference() string
func (*GameServer) Shutdown ¶
func (server *GameServer) Shutdown()
type InfoProvider ¶
type InfoProvider interface { GetServerInfo() *ServerInfo GetClientInfo() []*ClientExtInfo GetTeamInfo() *TeamInfo GetUptime() int // seconds }
type MapRequest ¶
type ServerInfo ¶
type ServerInfo struct { NumClients int32 GamePaused bool GameMode int32 // Seconds TimeLeft int32 MaxClients int32 PasswordMode int32 GameSpeed int32 Map string Description string }
func DecodeServerInfo ¶
func DecodeServerInfo(p io.Packet) (*ServerInfo, error)
type ServerInfoService ¶
type ServerInfoService struct {
// contains filtered or unexported fields
}
func NewServerInfoService ¶
func NewServerInfoService(provider InfoProvider) *ServerInfoService
func (*ServerInfoService) Handle ¶
func (s *ServerInfoService) Handle(request *io.Packet, out chan []byte) error
func (*ServerInfoService) PollMaster ¶
func (s *ServerInfoService) PollMaster(ctx context.Context, port int)
func (*ServerInfoService) Shutdown ¶
func (s *ServerInfoService) Shutdown()
func (*ServerInfoService) UpdateMaster ¶
func (s *ServerInfoService) UpdateMaster(port int) error
type ServerManager ¶
type ServerManager struct { Servers []*GameServer Receive chan []byte Mutex sync.Mutex Maps *assets.AssetFetcher // contains filtered or unexported fields }
func NewServerManager ¶
func NewServerManager( maps *assets.AssetFetcher, serverDescription string, presets []config.Preset, ) *ServerManager
func (*ServerManager) FindPreset ¶
func (manager *ServerManager) FindPreset(presetName string, isVirtualOk bool) opt.Option[config.Preset]
func (*ServerManager) GetServerInfo ¶
func (manager *ServerManager) GetServerInfo() *ServerInfo
func (*ServerManager) NewServer ¶
func (manager *ServerManager) NewServer(ctx context.Context, presetName string, isVirtualOk bool) (*GameServer, error)
func (*ServerManager) PollMapRequests ¶
func (manager *ServerManager) PollMapRequests(ctx context.Context, server *GameServer)
func (*ServerManager) PruneServers ¶
func (manager *ServerManager) PruneServers(ctx context.Context)
func (*ServerManager) ReadEntities ¶
func (manager *ServerManager) ReadEntities(ctx context.Context, server *GameServer, data []byte) error
func (*ServerManager) ReceiveKicks ¶
func (manager *ServerManager) ReceiveKicks() <-chan ClientKick
func (*ServerManager) ReceivePackets ¶
func (manager *ServerManager) ReceivePackets() <-chan ClientPacket
func (*ServerManager) RemoveServer ¶
func (manager *ServerManager) RemoveServer(server *GameServer)
func (*ServerManager) Shutdown ¶
func (manager *ServerManager) Shutdown()
func (*ServerManager) Start ¶
func (manager *ServerManager) Start() error
type ServerUptime ¶
type ServerUptime struct {
TimeUp int
}
func DecodeServerUptime ¶
func DecodeServerUptime(p io.Packet) (*ServerUptime, error)
Click to show internal directories.
Click to hide internal directories.