gorcon

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 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) AuthTimeout added in v0.1.0

func (c *Rconn) AuthTimeout(password string, timeout time.Duration) error

func (*Rconn) ExecCommand

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

func (*Rconn) ExecCommandTimeout added in v0.1.0

func (c *Rconn) ExecCommandTimeout(command string, timeout time.Duration) (string, error)

func (*Rconn) ReadPacket

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

func (*Rconn) ReadPacketTimeout added in v0.1.0

func (c *Rconn) ReadPacketTimeout(pac *Packet, timeout time.Duration) error

func (*Rconn) WritePacket

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

func (*Rconn) WritePacketTimeout added in v0.1.0

func (c *Rconn) WritePacketTimeout(pac *Packet, timeout time.Duration) error

Jump to

Keyboard shortcuts

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