query

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package query asks running game servers who is on them, the way their own server lists do.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type A2SInfo

type A2SInfo struct {
	Name       string
	Map        string
	Game       string
	Players    int
	MaxPlayers int
	Bots       int
}

A2SInfo is the part of Valve's Source query answer that Zelie reads.

func A2S

func A2S(ctx context.Context, addr string) (A2SInfo, error)

A2S sends A2S_INFO over UDP to addr, a host and port, and reads what the server says about itself.

type MinecraftStatus

type MinecraftStatus struct {
	// Raw is the JSON the server sent.
	Raw     string
	Version string
	Online  int
	Max     int
}

MinecraftStatus is what a Java Edition server answers to a server list ping.

func Minecraft

func Minecraft(ctx context.Context, addr string) (MinecraftStatus, error)

Minecraft asks the server at addr, a host and port, for its status with the Server List Ping: a handshake with next state 1, then a status request. Every packet is its length and its body, and numbers in them are VarInts.

Jump to

Keyboard shortcuts

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