Documentation ¶
Index ¶
- type Connection
- func (c *Connection) Close()
- func (c *Connection) Compression() bool
- func (c *Connection) CompressionThreshold() int32
- func (c *Connection) Disconnect(reason text.Text)
- func (c *Connection) ReadPacket() (packet.Packet, error)
- func (c *Connection) UpdateCompressionThreshold(threshold int32) error
- func (c *Connection) WritePacket(pk packet.Packet) error
- type DefaultStatusProvider
- type ListenConfig
- type Listener
- type Player
- type Players
- type Status
- type StatusProvider
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is a connection on an Expresso listener.
func (*Connection) Compression ¶
func (c *Connection) Compression() bool
Compression returns true if the connection is compressing packets.
func (*Connection) CompressionThreshold ¶
func (c *Connection) CompressionThreshold() int32
CompressionThreshold returns the compression threshold for the connection.
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect(reason text.Text)
Disconnect disconnects the connection for a given reason.
func (*Connection) ReadPacket ¶
func (c *Connection) ReadPacket() (packet.Packet, error)
ReadPacket reads a packet from the readable packets available.
func (*Connection) UpdateCompressionThreshold ¶
func (c *Connection) UpdateCompressionThreshold(threshold int32) error
UpdateCompressionThreshold updates the compression threshold for the connection.
func (*Connection) WritePacket ¶
func (c *Connection) WritePacket(pk packet.Packet) error
WritePacket writes a packet to the connection.
type DefaultStatusProvider ¶
type DefaultStatusProvider struct{}
DefaultStatusProvider is the default status of the listener.
func (*DefaultStatusProvider) Status ¶
func (d *DefaultStatusProvider) Status() Status
Status returns the status of the listener.
type ListenConfig ¶
type ListenConfig struct { // ErrorLog is a log.Logger that errors that occur during packet handling of clients are written to. By // default, ErrorLog is set to one equal to the global logger. ErrorLog *log.Logger // DisableAuthentication is true if logins should not be verified with Minecraft/Mojang. DisableAuthentication bool // StatusProvider represents the server list status which is displayed on the multiplayer screen. StatusProvider StatusProvider }
ListenConfig configures certain parts of the listener.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener is an Expresso listener. It listens on TCP for Minecraft packets, decodes them, and allows other parts of the program to handle packets.
func (*Listener) Accept ¶
func (l *Listener) Accept() (*Connection, error)
Accept accepts a new connection from the listener.
func (*Listener) StatusProvider ¶
func (l *Listener) StatusProvider() StatusProvider
StatusProvider returns the listeners' status provider.
func (*Listener) UpdateStatusProvider ¶
func (l *Listener) UpdateStatusProvider(status StatusProvider)
UpdateStatusProvider updates the server status.
type Players ¶
type Players struct { Max int `json:"max"` Online int `json:"online"` Sample []Player `json:"sample"` }
Players represents the part of the listener that holds a sample of players.
type Status ¶
type Status struct { Version Version `json:"version"` Players Players `json:"players"` Description text.Text `json:"description"` Favicon string `json:"favicon,omitempty"` }
Status contains status information about the server. It is used for the multiplayer list.
type StatusProvider ¶
type StatusProvider interface { // Status returns the status of the listener. Status() Status }
StatusProvider provides the status of the listener when requested.