Documentation ¶
Overview ¶
ping package implements the mincraft Server List Ping protocol. This package is strictly compliant with the following documentation : https://wiki.vg/Server_List_Ping
Index ¶
Constants ¶
const ( UnknownProtocolVersion int32 = -1 HandshakePacketID uint32 = 0 PingPacketID uint32 = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PingClient ¶
type PingClient struct {
// contains filtered or unexported fields
}
PingClient is the ping client.
func NewClient ¶
func NewClient(hostname string, port int) *PingClient
NewClient returns a well-formed *PingClient.
func (*PingClient) Connect ¶
func (client *PingClient) Connect() error
Connect establishes a connection via TCP.
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) Handshake ¶
func (client *PingClient) Handshake() (Handshake, error)
Handshake sends a handshake request to the server, and returns the formatted result.
func (*PingClient) Ping ¶
func (client *PingClient) Ping() (int, error)
Ping sends a ping request to the server, and returns the latency in ms. A ping request must be done after a handshake request has already been done.
func (*PingClient) SetDialOptions ¶
func (client *PingClient) SetDialOptions(dialOptions networking.DialTCPOptions)
SetDialOptions sets the options used in the dial process of the connection.