Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddGroup ¶
func AddGroup(g *Group)
AddGroup stores a group in the groups map to be used for lookups.
func RemoveGroup ¶
func RemoveGroup(name string)
RemoveGroup removes a group from the map, meaning it can no longer be used for lookups etc.
func SetDefaultGroup ¶
func SetDefaultGroup(g *Group)
SetDefaultGroup sets the default group that is commonly used for loading balancing.
Types ¶
type Client ¶
type Client interface { io.Closer // Name returns the name of the Client. This must be unique for all clients as it is used for // identification by the proxy and other clients. Name() string // ReadPacket reads a packet from the Client and returns it. It also returns an error in case one // occurred whilst reading the packet. ReadPacket() (packet.Packet, error) // WritePacket writes a packet to the Client. It returns an error in case one occurred whilst writing the // packet. WritePacket(pk packet.Packet) error }
Client represents a client connected over the TCP socket system.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a group of servers on the proxy. Groups are used to keep servers organized and in one place on the proxy, making it easier for servers to separate different parts of their network.
func DefaultGroup ¶
func DefaultGroup() *Group
DefaultGroup returns the default group that is commonly used for load balancing.
func GroupFromName ¶
GroupFromName attempts to find a group with the name provided. The group and a bool to say if the group is found or not is returned.
func (*Group) AddServer ¶
AddServer adds the provided server to the group, overriding existing ones if the name conflicts.
func (*Group) RemoveServer ¶
RemoveServer removes the provided server name from the group.
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 (*Server) Address ¶
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) Conn ¶
Conn returns the TCP socket client the server is connected to. If the server is not connected, this function returns nil.
func (*Server) Connected ¶
Connected returns if the server is connected to the TCP socket server or not.
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) PlayerCount ¶
PlayerCount returns the player count of the server controlled by the IncrementPlayerCount and DecrementPlayerCount functions above.