rcon

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 6 Imported by: 0

README

gorcon

A Minecraft RCON client

Documentation

Overview

Package rcon extends net.Conn for RCON.

Example

A simple RCON client for Minecraft:

c, err := rcon.Dial("localhost:25575", "password")
if err != nil {
	log.Fatalf("%+v", err)
}
defer c.Close()

// Exec any commands
res, err := c.Command("/seed")
if err != nil {
	log.Fatalf("%+v", err)
}

fmt.Println(res) // Seed: [...]

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rcon added in v0.2.0

type Rcon struct {
	net.Conn
}

func Dial

func Dial(addr string, password string) (Rcon, error)
Example
addr := "minecraft:25575"
password := "minecraft"
c, err := Dial(addr, password)
if err != nil {
	panic(err)
}
defer c.Close()
Output:

func DialTimeout

func DialTimeout(addr string, password string, timeout time.Duration) (Rcon, error)
Example
addr := "minecraft:25575"
password := "minecraft"
c, err := DialTimeout(addr, password, time.Duration(500)*time.Millisecond)
if err != nil {
	panic(err)
}
defer c.Close()
Output:

func (*Rcon) Command added in v0.2.0

func (c *Rcon) Command(command string) (string, error)

For details about commands, see the wiki https://minecraft.fandom.com/wiki/Commands.

Example
addr := "minecraft:25575"
password := "minecraft"
c, err := Dial(addr, password)
if err != nil {
	panic(err)
}
defer c.Close()

res, err := c.Command("/seed")
if err != nil {
	panic(err)
}

fmt.Println(res[:5])
Output:

Seed:

Directories

Path Synopsis
examples
nbt
Package packet provides RCON packet structure and handlers.
Package packet provides RCON packet structure and handlers.

Jump to

Keyboard shortcuts

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