Skip to content

Latest commit

 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rcon

A RCON client for executing commands on a remote RCON server.

This client implements the RCON protocol used by Minecraft servers and has the potential to work with other game servers as well, though it hasn't been extensively tested.

Usage

Open up a RCON session:

./rcon-cli -a <address> -p <password>

Run a single command on the server:

./rcon-cli -a <address> -p <password> -c <command>

Installation

Prebuild

Download the latest build for your platform from the latest release

Build

You can also build your own executable. This requires:

git
go v1.26 or higher
make

Run these commands to build the executable:

git clone https://github.com/sch8ill/rcon
cd rcon
make

Libary usage

Install the module using:

go get github.com/sch8ill/rcon

Import it:

import "github.com/sch8ill/rcon"

Create a new RCON client:

client, err := rcon.Dial("localhost", "password", 5) // address, password, timeout
if err != nil {
  panic(err)
}

Execute a command over RCON:

output, err := client.ExecuteCmd("stop")
if err != nil {
  panic(err)
}

fmt.Println(output)

--help

USAGE:
   rcon [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --address value, -a value   address of the server you want to connect to (localhost:25575 for example) (default: "localhost")
   --password value, -p value  password of the RCON server you want to connect to (default: "minecraft")
   --command value, -c value   a single command to be executed
   --timeout value, -t value   timeout for the connection to the server (default: 7s)
   --no-colors, --no-colours   if the cli should not output colors (default: false)
   --help, -h                  show help
   --version, -v               print the version

Environment Variables

Available environment variables:

export DEFAULT_RCON_ADDRESS="localhost:25575"
export DEFAULT_RCON_PASSWORD="password"
export DEFAULT_RCON_TIMEOUT="10s"

About

RCON client for executing commands on a remote RCON server

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages