gorcon

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 8 Imported by: 0

README

gorcon

A Minecraft RCON client

Documentation

Index

Constants

View Source
const (
	BadAuthRequestId         = -1
	RequestPayloadMaxLength  = 1446
	ResponsePayloadMaxLength = 4096
)
View Source
const (
	Auth          = PacketType(3)
	ExecCommand   = PacketType(2)
	ResponseValue = PacketType(0)
	DummyRequest  = PacketType(100)
)

Variables

This section is empty.

Functions

func Unpack

func Unpack(pac *Packet) ([]byte, error)

Types

type Header struct {
	Length    int32
	RequestId int32
	Type      PacketType
}

type Packet

type Packet struct {
	Header
	Payload []byte
}

func NewPacket

func NewPacket(i int32, t PacketType, p []byte) *Packet

func Pack

func Pack(raw []byte) (*Packet, error)

type PacketType

type PacketType int32

type Rconn

type Rconn struct {
	net.Conn
}

func Dial

func Dial(addr string) (Rconn, error)

func DialTimeout

func DialTimeout(addr string, timeout time.Duration) (Rconn, error)

func (*Rconn) Auth

func (c *Rconn) Auth(password string) error

func (*Rconn) ExecCommand

func (c *Rconn) ExecCommand(command string) (string, error)

func (*Rconn) ReadPacket

func (c *Rconn) ReadPacket(pac *Packet) error

func (*Rconn) WritePacket

func (c *Rconn) WritePacket(pac *Packet) error

Jump to

Keyboard shortcuts

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