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
func Dial ¶
Example ¶
addr := "minecraft:25575"
password := "minecraft"
c, err := Dial(addr, password)
if err != nil {
panic(err)
}
defer c.Close()
func DialTimeout ¶
Example ¶
addr := "minecraft:25575"
password := "minecraft"
c, err := DialTimeout(addr, password, time.Duration(500)*time.Millisecond)
if err != nil {
panic(err)
}
defer c.Close()
func (*Rcon) Command ¶ added in v0.2.0
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:
Click to show internal directories.
Click to hide internal directories.