rcon

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERVERDATA_AUTH           packetType = 3
	SERVERDATA_AUTH_RESPONSE  packetType = 2
	SERVERDATA_AUTH_FAILED    packetType = -1
	SERVERDATA_EXECCOMMAND    packetType = 2
	SERVERDATA_RESPONSE_VALUE packetType = 0
)

RCON request / response codes

View Source
const NUL = "\x00"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config config.Config
	Conn   *net.TCPConn
}

Client represents an RCON client.

func NewClient

func NewClient(cfg config.Config) (Client, error)

NewClient creates a Client and connects to the RCON service.

func (*Client) Auth

func (c *Client) Auth() (err error)

Authenticate to the RCON service.

func (*Client) Command

func (c *Client) Command(command ...string) (resp string, err error)

type Packet

type Packet struct {
	Size    int32      // Size of message
	Id      int32      // Message ID
	Type    packetType // Message type (see SERVERDATA_ constants)
	Payload []byte     // Message payload
}

Packet represents an RCON request or response packet.

func NewPacket

func NewPacket(t packetType, payload string) Packet

NewPacket constructs a new Packet of type t that delivers payload p.

func Unmarshall

func Unmarshall(data []byte) (Packet, error)

Unmarshall unpacks the binary representation of a Packet.

func (Packet) Marshall

func (r Packet) Marshall() ([]byte, error)

Marshall converts the Packet into its binary representation.

func (*Packet) String

func (p *Packet) String() string

String implements the Stringer interface for Packet.

Jump to

Keyboard shortcuts

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