mcping

package
v0.0.0-...-a2ba4d9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pinger

type Pinger struct {
	DnsResolver types.DnsResolver
	Latency     types.Latency
}

func NewPinger

func NewPinger() *Pinger

Create a new Minecraft Pinger

func NewPingerWithDnsResolver

func NewPingerWithDnsResolver(dnsResolver types.DnsResolver) *Pinger

Create a new Minecraft Pinger with a custom DNS resolver

func (*Pinger) Ping

func (p *Pinger) Ping(host string, port uint16) (*types.PingResponse, error)

Ping and get information from an host and port, default timeout: 3s Return a pointer to types.PingResponse or an error

Error is thrown when the host is unreachable or the data received are incorrect

Example: Pinger.Ping("play.hypixel.net", 25565)

func (*Pinger) PingWithTimeout

func (p *Pinger) PingWithTimeout(host string, port uint16, timeout time.Duration) (*types.PingResponse, error)

Ping and get information from an host and port with a custom timeout Return a pointer to types.PingResponse or an error

Error is thrown when the host is unreachable or the data received are incorrect

Example: pinger.Ping("play.hypixel.net", 25565, 5 * time.Second)

Jump to

Keyboard shortcuts

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