ping

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2022 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AncientResponse

type AncientResponse struct {
	MessageOfTheDay string
	PlayerCount     uint32
	MaxPlayers      uint32
}

AncientResponse represents ping response from old servers (Beta 1.8 to 1.3) Minecraft servers.

func PingAncient

func PingAncient(host string, port uint16) (*AncientResponse, error)

PingAncient performs a Server List Ping interaction with old (Beta 1.8 to 1.3) Minecraft server running on the specified host and the specified port.

func PingAncientWithTimeout

func PingAncientWithTimeout(host string, port uint16, timeout time.Duration) (*AncientResponse, error)

PingAncientWithTimeout performs a Server List Ping interaction with old (Beta 1.8 to 1.3) Minecraft server running on the specified host and the specified port with read and write timeout.

type Chat added in v1.1.0

type Chat interface{}

Chat represents arbitrary JSON-encoded chat components structure used in modern (1.7 and earlier) Minecraft server descriptions.

type LegacyResponse

type LegacyResponse struct {
	ProtocolVersion uint32
	Version         string
	MessageOfTheDay string
	PlayerCount     uint32
	MaxPlayers      uint32
}

LegacyResponse represents ping response from legacy (1.4 to 1.6) Minecraft servers.

func PingLegacy

func PingLegacy(host string, port uint16) (*LegacyResponse, error)

PingLegacy performs a Server List Ping interaction with legacy (1.4 to 1.6) Minecraft server running on the specified host and the specified port.

func PingLegacyWithTimeout

func PingLegacyWithTimeout(host string, port uint16, timeout time.Duration) (*LegacyResponse, error)

PingLegacyWithTimeout performs a Server List Ping interaction with legacy (1.4 to 1.6) Minecraft server running on the specified host and the specified port with read and write timeout.

type Response

type Response struct {
	Version struct {
		Name     string `json:"name"`
		Protocol int    `json:"protocol"`
	} `json:"version"`

	Players struct {
		Max    int `json:"max"`
		Online int `json:"online"`
		Sample []struct {
			Name string `json:"name"`
			ID   string `json:"id"`
		} `json:"sample"`
	}

	Description Chat `json:"description"`

	Favicon string `json:"favicon"`
}

Response represents ping response from modern (1.7 and earlier) Minecraft servers.

func Ping

func Ping(host string, port uint16) (*Response, error)

Ping performs a Server List Ping interaction with modern (1.7 and newer) Minecraft server running on the specified host and the specified port.

func PingWithTimeout

func PingWithTimeout(host string, port uint16, timeout time.Duration) (*Response, error)

PingWithTimeout performs a Server List Ping interaction with modern (1.7 and newer) Minecraft server running on the specified host and the specified port with read and write timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL