Go version of CS:GO RCON client released!



Golang package for CS:GO (or other Source Dedicated Server) RCON Protocol client.

For the protocol specification, go to Source RCON Protocol from Valve


  1. Import the package
import "github.com/forewing/csgo-rcon"
  1. Create a client with rcon.New(address, password string, timeout time.Duration), assuming your server rcon are hosted at, with password password, and you want the connection timeout to be 2 seconds.
c := rcon.New("", "password", time.Seconds * 2)
  1. Execute commands use *Client.Execute(cmd string). On success, a message and nil error will be returned. On failure, an empty message and error will be returned.

Command Line Tool


go get -u github.com/forewing/csgo-rcon/cmd/csgo-rcon


Usage of csgo-rcon:
  -a address
        address of the server RCON, in the format of HOST:PORT. (default "")
  -c file
        load configs from file instead of flags.
  -f file
        read commands from file, "-" for stdin. From arguments if not set.
  -i    interact with the console.
  -p password
        password of the RCON.
  -t timeout
        timeout of the connection (seconds). (default 1)
  1. From arguments
$ csgo-rcon -c config.json mp_warmuptime 999
L **/**/20** - **:**:**: rcon from "**.**.**.**:***": command "mp_warmuptime 999"
  1. From file (- for stdin)
$ csgo-rcon -c config.json -f commands.cfg
  1. Interactive
$ csgo-rcon -c config.json -i
>>> bot_add_ct
L **/**/20** - **:**:**: "Derek<4><BOT><>" connected, address ""
L **/**/20** - **:**:**: "Derek<4><BOT>" switched from team <Unassigned> to <CT>
L **/**/20** - **:**:**: "Derek<4><BOT><>" entered the game
L **/**/20** - **:**:**: rcon from "**.**.**.**:***": command "bot_add_ct"
>>> users
0 users
L **/**/20** - **:**:**: rcon from "**.**.**.**:***": command "users"
>>> ^C