A simple RCON client written in Go
Note: This client doesn't yet implement the full RCON protocol spec.
go get -u github.com/sebasslash/rcon-go
import (
"log"
rcon "github.com/sebasslash/rcon-go"
)
func main() {
config := &rcon.RCONConfig{
Host: "my-awesome-server-ip",
Port: 27015,
Password: "my-awesome-server-pwd",
MaxPayloadSize: 4096,
}
client := &rcon.RCONClient{
Config: config
}
err := client.Open()
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Using a Mordhau specific RCON command
resp, err := client.SendCommand("playerlist")
if err != nil {
log.Fatal(err)
}
log.Printf("Server response:\n %s", resp)
}
In order to run the tests, a few env variables are expected:
RCON_GO_HOST
- The host to test againstRCON_GO_PORT
- The port the RCON service is listening onRCON_GO_PWD
- The password used for authenticationRCON_GO_TEST_COMMAND
- A test command to send to the server