Documentation
¶
Overview ¶
bedrock package implements the unconnected ping sequence of the raknet protocol (used by minecraft bedrock servers). This package is strictly compliant with the following documentation : https://wiki.vg/Raknet_Protocol.
Index ¶
Constants ¶
View Source
const ( UnconnectedPingPacketID byte = 0x01 UnconnectedPongPacketID byte = 0x1C )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type PingClient ¶
type PingClient struct { ClientGUID uint64 // options SkipSRVLookup bool ForceUDPProtocolForSRVLookup bool DialTimeout time.Duration ReadTimeout time.Duration // contains filtered or unexported fields }
PingClient is the bedrock ping client.
func NewClient ¶
func NewClient(hostname string, port int) *PingClient
NewClient returns a well-formed *PingClient. ClientGUID is set to a random value.
func (*PingClient) Connect ¶
func (client *PingClient) Connect() error
Connect establishes a connection via UDP.
func (*PingClient) Disconnect ¶
func (client *PingClient) Disconnect() error
Disconnect closes the connection. Connection is made not usable anymore no matter if the it closed properly or not.
func (*PingClient) UnconnectedPing ¶
func (client *PingClient) UnconnectedPing() (UnconnectedPong, int, error)
Handshake sends an unconncted ping request to the server, and returns the pong response informations.
type UnconnectedPong ¶
type UnconnectedPong struct { GameName string `json:"gameName"` MOTD string `json:"motd"` ProtocolVersion int `json:"protocolVersion"` MinecraftVersion string `json:"minecraftVersion"` OnlinePlayers int `json:"onlinePlayers"` MaxPlayers int `json:"maxPlayers"` ServerID string `json:"serverId"` LevelName string `json:"levelName"` GameMode string `json:"gameMode"` GameModeNumeric int `json:"gameModeNumeric"` IPv4Port int `json:"ipv4Port"` IPv6Port int `json:"ipv6Port"` }
UnconnectedPong contains unconnected pong informations.
Click to show internal directories.
Click to hide internal directories.