Documentation
¶
Overview ¶
Package gamestatus probes a game server's own published port: the Minecraft Java server list ping, with a plain TCP connect for other games.
Index ¶
Constants ¶
View Source
const ( KindMinecraft = "minecraft" KindTCP = "tcp" )
Kinds of answer a probe can give.
View Source
const (
// MaxPacketBytes bounds one status packet; a favicon response is ~10 KB.
MaxPacketBytes = 256 << 10
)
Protocol limits of the Java list ping, not tunables.
Variables ¶
View Source
var ( // ErrNotLoopback is returned for any target but this host's loopback. ErrNotLoopback = errors.New("gamestatus: target must be a loopback address") // ErrBadPacket is returned when the server reply is not a valid status packet. ErrBadPacket = errors.New("gamestatus: malformed status response") )
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status struct {
Kind string
Online bool
Version string
Players int
MaxPlayers int
LatencyMS int64
Description string
}
Status is one probe result.
func Probe ¶
Probe checks one loopback host:port. A Minecraft answer wins; a port that accepts a connection but does not speak the protocol is reported as TCP-open. Only loopback targets are allowed so a probe can never reach another host.
func ReadMinecraftStatus ¶
ReadMinecraftStatus runs the handshake, status request and ping over rw.
Click to show internal directories.
Click to hide internal directories.