Skip to content

Go library to ping Minecraft Bedrock/MCPE servers

License

Notifications You must be signed in to change notification settings

ZeroErrors/go-bedrockping

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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