ping

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 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
}

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 LegacyResponse

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

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 description `json:"description"`

	Favicon string `json:"favicon"`
}

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