ZeroErrors / go-bedrockping

Go library to ping Minecraft Bedrock/MCPE servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-bedrockping Go Report Card GoDoc Build Status

A simple Go library to ping Minecraft Bedrock/MCPE servers.

Usage

Installation

Install using go get github.com/ZeroErrors/go-bedrockping

Example Usage

package main

import (
	"fmt"
	"github.com/ZeroErrors/go-bedrockping"
	"log"
	"time"
)

func main() {
	resp, err := bedrockping.Query("myip:19132", 5 * time.Second, 150 * time.Millisecond)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d/%d players are online.", resp.PlayerCount, resp.MaxPlayers)
}

(The default port, 19132, is also available as a const, bedrockping.DefaultPort.)

Response

The response structure is described in bedrockping.Response

About

Go library to ping Minecraft Bedrock/MCPE servers

License:MIT License


Languages

Language:Go 100.0%