111 lines
2.2 KiB
Markdown
111 lines
2.2 KiB
Markdown
# gamestatus
|
|
|
|
Small Go library for querying game server status.
|
|
|
|
Current support:
|
|
|
|
- Minecraft Java
|
|
- Minecraft Bedrock
|
|
- Source / A2S servers
|
|
- Rust servers
|
|
- Counter-Strike 2 servers
|
|
- Valve/Source servers
|
|
|
|
The project is structured so other game protocols can be added later. Rust currently uses the same A2S-based transport layer as Source-style servers.
|
|
|
|
## Features
|
|
|
|
- Java status ping
|
|
- Java full query
|
|
- Bedrock RakNet ping
|
|
- Bedrock full query
|
|
- Source A2S info
|
|
- Source A2S players and rules via full query
|
|
- Rust query via the same Source/A2S layer
|
|
- CS2 query via the same Source/A2S layer
|
|
- Valve query via the same Source/A2S layer
|
|
- Optional SRV lookup
|
|
- Simple MOTD cleanup helper
|
|
|
|
## Install
|
|
|
|
```bash
|
|
go get github.com/VexoraDevelopment/gamestatus
|
|
```
|
|
|
|
## CLI
|
|
|
|
The repository also ships a small CLI in `cmd/gamestatus`.
|
|
|
|
Build locally:
|
|
|
|
```bash
|
|
go build -o gamestatus ./cmd/gamestatus
|
|
```
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
gamestatus mc.hypixel.net
|
|
gamestatus java -json mc.hypixel.net
|
|
gamestatus bedrock -query play.example.com:19132
|
|
gamestatus source 127.0.0.1:27015
|
|
gamestatus rust 127.0.0.1:28015
|
|
gamestatus cs2 127.0.0.1:27015
|
|
gamestatus valve 127.0.0.1:27015
|
|
gamestatus auto -pretty localhost
|
|
gamestatus java -motd-raw mc.hypixel.net
|
|
```
|
|
|
|
If you prefer prebuilt binaries, use the files attached to GitHub Releases.
|
|
|
|
## Quick Start
|
|
|
|
```go
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/VexoraDevelopment/gamestatus"
|
|
)
|
|
|
|
func main() {
|
|
client := gamestatus.NewAll(3 * time.Second)
|
|
|
|
info, err := client.Java.Connect("hypixel.net", 25565)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
fmt.Println(info.Edition)
|
|
fmt.Println(info.Address, info.Port)
|
|
fmt.Println(info.Version)
|
|
fmt.Println(info.Online, "/", info.Slots)
|
|
fmt.Println(info.MOTD)
|
|
}
|
|
```
|
|
|
|
## Packages
|
|
|
|
- `github.com/VexoraDevelopment/gamestatus`
|
|
- `github.com/VexoraDevelopment/gamestatus/java`
|
|
- `github.com/VexoraDevelopment/gamestatus/bedrock`
|
|
- `github.com/VexoraDevelopment/gamestatus/source`
|
|
- `github.com/VexoraDevelopment/gamestatus/text`
|
|
|
|
## Releases
|
|
|
|
Pushing a tag like `v1.0.1` triggers GitHub Actions and publishes release archives for:
|
|
|
|
- Windows
|
|
- Linux
|
|
- macOS
|
|
|
|
using the `gamestatus` CLI binary from `cmd/gamestatus`.
|
|
|
|
## Notes
|
|
|
|
- `ServerInfo` is a plain struct and can be stored however you want.
|