mcstatus

package module
v0.0.0-...-0de2e88 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2015 License: MIT Imports: 14 Imported by: 0

README

mcstatus

Tool and package for getting Minecraft server status in Go language

Documentation

Index

Constants

This section is empty.

Variables

View Source
var COLOR_EXPR = regexp.MustCompile("(?i)§[a-z0-9]")
View Source
var DEADLINE = 3 * time.Second
View Source
var LAST_NEW_PROTOCOL int = 4
View Source
var LAST_OLD_PROTOCOL uint8 = 74

Functions

func Resolve

func Resolve(hostport string) (addr *net.TCPAddr, err error)

resolves addres minecraft style, with dumb SRV records

Types

type MinecraftStatus

type MinecraftStatus struct {
	NewProtocol     bool
	ProtocolVersion int
	GameVersion     string
	Slots           int
	Players         int
	PlayersSample   []string
	Description     string
	Favicon         []byte
	Raw             *json.RawMessage `json:"-"`
}

func CheckStatus

func CheckStatus(addr *net.TCPAddr) (status *MinecraftStatus, ping time.Duration, err error)

check minecraft status, first tries new protocol, later older

func CheckStatusNew

func CheckStatusNew(addr *net.TCPAddr, host string, port uint16) (*MinecraftStatus, time.Duration, error)

func CheckStatusNewConn

func CheckStatusNewConn(conn *net.TCPConn, host string, port uint16) (*MinecraftStatus, time.Duration, error)

func CheckStatusOld

func CheckStatusOld(addr *net.TCPAddr, host string, port uint16) (*MinecraftStatus, time.Duration, error)

func CheckStatusOldConn

func CheckStatusOldConn(conn *net.TCPConn, host string, port uint16) (*MinecraftStatus, time.Duration, error)

func (*MinecraftStatus) SerializeNew

func (status *MinecraftStatus) SerializeNew() ([]byte, error)

func (*MinecraftStatus) SerializeOld

func (status *MinecraftStatus) SerializeOld(protocol int) ([]byte, error)

func (*MinecraftStatus) String

func (status *MinecraftStatus) String() string

Jump to

Keyboard shortcuts

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