Categorygithub.com/csgoservers/source-rcon
repository
0.0.0-20210325154003-4d20082b8e70
Repository: https://github.com/csgoservers/source-rcon.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author

# README

Source RCON Protocol

GitHub repo size GitHub issues

See license if you plan to run this software. If you have any doubt contact us.

The Source RCON Protocol is a TCP/IP based communication protocol used by Source Dedicated Server, which allows console commands to be issued to the server via a remote console.

Reference

How to use it?

If you want to use this protocol implementation in your own projects, you only need to execute the next command in your project root directory:

$ go get -u github.com/csgoservers/source-rcon/pkg/protocol

To use it in your code, you first need to specify the connection details like host, port and server password. Then you can create the connection and send commands over it. See the next block to use as a template:

import rcon "github.com/csgoservers/source-rcon/pkg/protocol"

func main() {
  opts := &rcon.Options{
	Host:     "127.0.0.1",
	Port:     27025,
	Password: "1234",
  }
  conn := rcon.New(opts)
  defer conn.Close()

  result, err := conn.ExecCommand("cvarlist")
  if err != nil {
	return
  }
  // transform `result` to a string
}

If you have any issue, please send it here.

CLI

Also, if you only want to execute some commands over a Source Dedicated Servers, then you can execute the rcon-cli application. To use it you just need to clone this repository and execute the make build directive. You can change some flags to configure your server settings. See the table below:

NameDefault valueDescription
-H127.0.0.1Host where the server is running
-p27015Port where server is listening for connections. TCP
-sPassword of the server if any
-cCommand to be executed

Note that the -c flag is required in order to run the cli.

For example, if you want to execute the cvarlist command then you will use the following command:

$ ./rcon-cli -H 1.2.3.4 -p 27025 -s 1234 -c cvarlist

Test

If you want to execute all tests from this repository then execute make test.

License

This is not an official Steam product. csgoservers.xyz is not affiliated with Valve Corporation or Counter-Strike

See LICENSE

License