Documentation ¶
Overview ¶
Package mcping facilitates the pinging of Minecraft servers using the 1.7+ protocol.
Index ¶
Constants ¶
View Source
const ( //DefaultTimeout stores default ping timeout DefaultTimeout = time.Second )
Variables ¶
View Source
var ErrAddress = errors.New("mcping: could not parse address")
ErrAddress -> Could not parse address
View Source
var ErrBigPacket = errors.New("mcping: Response too large")
ErrBigPacket -> Response is too large
View Source
var ErrPacketType = errors.New("mcping: Response packet type incorrect")
ErrPacketType -> Response packet incorrect
View Source
var ErrResolve = errors.New("mcping: Could not resolve address")
ErrResolve -. Could not resolve address
View Source
var ErrSmallPacket = errors.New("mcping: Response too small")
ErrSmallPacket -> Response is too small
View Source
var ErrTimeout = errors.New("mcping: Timeout occured")
ErrTimeout -> Timeout error
Functions ¶
This section is empty.
Types ¶
type PingResponse ¶
type PingResponse struct { Latency uint `json:"latency"` //Latency in ms Online int `json:"online"` //Amount of online players Max int `json:"max"` //Maximum amount of players Protocol int `json:"protocol"` //E.g '4' Favicon []byte `json:"favicon"` //Base64 encoded favicon in data URI format Motd string `json:"motd"` Server string `json:"server"` //E.g 'PaperSpigot' Version string `json:"version"` //E.g "1.7.10" Sample []PlayerSample `json:"sample"` }
PingResponse contains all known fields of the ping response packet
func PingTimeout
deprecated
func PingTimeout(addr string, timeout int) (PingResponse, error)
Deprecated: PingTimeout Pings with custom timeout
func PingWithTimeout ¶
func PingWithTimeout(addr string, timeout time.Duration) (PingResponse, error)
PingWithTimeout pings with custom timeout
type PlayerSample ¶
type PlayerSample struct { UUID string `json:"uuid"` //e.g "d8a973a5-4c0f-4af6-b1ea-0a76cd210cc5" Name string `json:"name"` //e.g "Ammar" }
PlayerSample contains a player response in the sample section of a ping response.
Click to show internal directories.
Click to hide internal directories.