Documentation ¶
Index ¶
Constants ¶
const ( Challenge = 0x09 Statistics = 0x00 )
const (
GameId = "MINECRAFTPE"
)
Variables ¶
var Header = []byte{0xfe, 0xfd}
Header is the header of each query.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles the sequence of incoming queries.
func NewManager ¶
func NewManager() Manager
NewManager returns a new query manager with the given server.
func (*Manager) HandleQuery ¶
HandleQuery handles an incoming query.
func (*Manager) SetQueryResult ¶
SetQueryResult sets the query result data a query will receive when querying us.
type Query ¶
type Query struct { *binutils.Stream Address string Port uint16 Header byte QueryId int32 Token []byte Statistics []byte IsShort bool Data []byte }
Query is used to encode/decode queries.
func NewFromRaw ¶
NewQueryFromRaw returns a query from a raw packet.
func (*Query) DecodeClient ¶
func (query *Query) DecodeClient()
DecodeClient decodes a query sent by the server.
func (*Query) DecodeServer ¶
func (query *Query) DecodeServer()
DecodeServer decodes the query sent by the client.
func (*Query) EncodeClient ¶
func (query *Query) EncodeClient()
EncodeClient encodes a query to send to the server.
func (*Query) EncodeServer ¶
func (query *Query) EncodeServer()
EncodeServer encodes the query to send to the client.
type Result ¶
type Result struct { MOTD string ListPlugins bool PluginNames []string PlayerNames []string GameMode string Version string ServerEngine string WorldName string OnlinePlayers int MaximumPlayers int Whitelist string Port uint16 Address string }
Result is a struct containing all information received by querying a server. Results should be constructed in order to send too.
func Send ¶
Send queries a server with the given address and port. The call times out after the given timeout duration if no response is given.
NOTE: This function is time consuming and should be used one a different goroutine where adequate.