server

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry added in v0.2.0

type Registry struct {
	// contains filtered or unexported fields
}

Registry represents a registry which stores the severs registered on the proxy.

func NewDefaultRegistry added in v0.2.0

func NewDefaultRegistry() *Registry

NewDefaultRegistry creates a new Registry and returns it.

func (*Registry) AddServer added in v0.2.0

func (r *Registry) AddServer(srv *Server)

AddServer adds a server to the register.

func (*Registry) RemoveServer added in v0.2.0

func (r *Registry) RemoveServer(srv *Server)

RemoveServer removes a server from the register.

func (*Registry) Server added in v0.2.0

func (r *Registry) Server(name string) (*Server, bool)

Server attempts to find a server from its name, and returns the server and if it was found or not.

func (*Registry) Servers added in v0.2.0

func (r *Registry) Servers() (all []*Server)

Servers returns a slice of all the available servers on the proxy.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server represents a server connected to the proxy which players can join and play on.

func New

func New(name, address string) *Server

New creates a new Server with the provided name, group and address.

func (*Server) Address

func (s *Server) Address() string

Address returns the IP address the server was registered with. This should also contain the port separated by a colon. E.g. "127.0.0.1:19132".

func (*Server) DecrementPlayerCount

func (s *Server) DecrementPlayerCount()

DecrementPlayerCount decreases the player count of the server.

func (*Server) IncrementPlayerCount

func (s *Server) IncrementPlayerCount()

IncrementPlayerCount increments the player count of the server.

func (*Server) Name

func (s *Server) Name() string

Name returns the name the server was registered with.

func (*Server) PlayerCount

func (s *Server) PlayerCount() int

PlayerCount returns the player count of the server controlled by the IncrementPlayerCount and DecrementPlayerCount functions above.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL