ping

package
v0.0.0-...-f92d382 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2016 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package ping is used for reading and sending data regarding handshaking, pinging and connecting. It follows the Minecraft protocol version 5.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisplayMessage

func DisplayMessage(s protocol.Stream, message string) error

DisplayMessage responds with a disconnect message to the player when they attempt to connect to the server.

func HandlePingPacket

func HandlePingPacket(s protocol.Stream, status Status) error

HandlePingPacket handles a ping packet used by the Minecraft client used to measure the round trip time of the connection.

func WriteHandshakeResponse

func WriteHandshakeResponse(s protocol.Stream, status Status) error

WriteHandshakeResponse writes a response with a status that will be displayed on the requesting player's server list menu.

Types

type HandshakePacket

type HandshakePacket struct {
	ProtocolNumber int
	ServerAddress  string
	ServerPort     uint16
	NextState      int
}

HandshakePacket contains the decoded data from a handshake packet. See ReadHandshakePacket.

func ReadHandshakePacket

func ReadHandshakePacket(s protocol.Stream) (HandshakePacket, error)

ReadHandshakePacket reads a handshake packet (packet ID 0) and decodes it.

type Status

type Status struct {
	OnlinePlayers  int
	MaxPlayers     int
	Message        string
	ShowConnection bool
	// ProtocolNumber is the internal protocol version number to respond with
	// that can be found at http://wiki.vg/Protocol_version_numbers
	ProtocolNumber int
}

Status is the container for the information to respond with on the Minecraft server list menu.

Jump to

Keyboard shortcuts

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