90 lines
1.6 KiB
Markdown
90 lines
1.6 KiB
Markdown
# mcstatus
|
|
|
|
Small Go library for querying Minecraft Java and Bedrock server status.
|
|
|
|
## Features
|
|
|
|
- Java status ping
|
|
- Java full query
|
|
- Bedrock RakNet ping
|
|
- Bedrock full query
|
|
- Optional SRV lookup
|
|
- Simple MOTD cleanup helper
|
|
|
|
## Install
|
|
|
|
```bash
|
|
go get github.com/VexoraDevelopment/mcstatus
|
|
```
|
|
|
|
## CLI
|
|
|
|
The repository also ships a small CLI in `cmd/mcstatus`.
|
|
|
|
Build locally:
|
|
|
|
```bash
|
|
go build -o mcstatus ./cmd/mcstatus
|
|
```
|
|
|
|
Examples:
|
|
|
|
```bash
|
|
mcstatus mc.hypixel.net
|
|
mcstatus java -json mc.hypixel.net
|
|
mcstatus bedrock -query play.example.com:19132
|
|
mcstatus auto -pretty localhost
|
|
mcstatus 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/mcstatus"
|
|
)
|
|
|
|
func main() {
|
|
client := mcstatus.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/mcstatus`
|
|
- `github.com/VexoraDevelopment/mcstatus/java`
|
|
- `github.com/VexoraDevelopment/mcstatus/bedrock`
|
|
- `github.com/VexoraDevelopment/mcstatus/text`
|
|
|
|
## Releases
|
|
|
|
Pushing a tag like `v1.0.1` triggers GitHub Actions and publishes release archives for:
|
|
|
|
- Windows
|
|
- Linux
|
|
- macOS
|
|
|
|
using the `mcstatus` CLI binary from `cmd/mcstatus`.
|
|
|
|
## Notes
|
|
|
|
- `ServerInfo` is a plain struct and can be stored however you want.
|