Documentation ¶
Index ¶
Constants ¶
const ( UnknownProtoVersion = -1 StatusState = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatComponent ¶
type ChatComponent struct {
RegularChatComponent
}
ChatComponent wraps a RegularChatComponent for parsing both regular & string-only MOTD's
func (*ChatComponent) UnmarshalJSON ¶
func (c *ChatComponent) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the JSON data
type InvalidPacketError ¶
type InvalidPacketError struct {
// contains filtered or unexported fields
}
InvalidPacketError returned when the received packet type does not match the expected packet type.
func (InvalidPacketError) Error ¶
func (i InvalidPacketError) Error() string
type McPingerOption ¶ added in v0.2.0
type McPingerOption func(p *mcPinger)
McPingerOption instances can be combined when creating a new Pinger
func WithContext ¶ added in v0.2.0
func WithContext(ctx context.Context) McPingerOption
func WithProxyProto ¶ added in v0.2.0
func WithProxyProto(version byte) McPingerOption
WithProxyProto enables support for Bungeecord's proxy_protocol feature, which listens for PROXY protocol connections via HAproxy. version must be 1 (text) or 2 (binary).
func WithTimeout ¶ added in v0.2.0
func WithTimeout(timeout time.Duration) McPingerOption
type Pinger ¶
type Pinger interface {
Ping() (*ServerInfo, error)
}
Pinger allows you to retrieve server info.
func New ¶
func New(host string, port uint16, options ...McPingerOption) Pinger
New Creates a new Pinger with specified host & port to connect to a minecraft server
type Player ¶
type Player struct { Name string `json:"name"` // Player name ID string `json:"id"` // Player UUID }
Server info player
type Players ¶
type Players struct { Max int32 `json:"max"` // Max amount of players allowed Online int32 `json:"online"` // Amount of players online Sample []Player // Sample of online players }
Server info players
type RegularChatComponent ¶
type RegularChatComponent struct { Text string `json:"text"` // Text content Bold bool `json:"bold"` // Component is emboldened Italic bool `json:"italic"` // Component is italicized Underlined bool `json:"underlined"` // Component is underlined Strikethrough bool `json:"strikethrough"` // Component is struck out Obfuscated bool `json:"obfuscated"` // Component randomly switches between characters of the same width Color string `json:"color"` // Contains the color for the component Extra []ChatComponent `json:"extra"` // siblings }
RegularChatComponent is a Minecraft chat component See: https://wiki.vg/Chat#Current_system_.28JSON_Chat.29 and https://wiki.vg/Text_formatting#Content_fields
type ServerInfo ¶
type ServerInfo struct { Version Version `json:"version"` // Server version info Players Players `json:"players"` // Server player info Description ChatComponent `json:"description"` // Server description Favicon string `json:"favicon"` // Server favicon }
Server ping response https://wiki.vg/Server_List_Ping#Response