rcon-cli

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 10 Imported by: 0

README

rcon-cli

Go Report Card GitHub All Releases

CLI for executing queries on a remote server

Supported Games

Open pull request if you have successfully used a package with another game with rcon support and add it to the list.

Installation

Download the binary for your platform from the latest releases

See Changelog for release details

Usage

USAGE:
   rcon-cli [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  set host and port to remote rcon server. Example 127.0.0.1:16260
                              can be set in the config file rcon.yaml
   --password value, -p value  set password to remote rcon server
                               can be set in the config file rcon.yaml
   --command value, -c value  command to execute on remote server. Required flag to run in single mode
   --env value, -e value      allows to select remote server address and password from the environment
                              in the configuration file
   --cfg value  allows to specify the path and name of the configuration file. The default
                value is rcon.yaml. If not defined config is taken from the running directory.
   --help, -h     show help
   --version, -v  print the version

Rcon CLI can be run in two modes - in the mode of a single query and in the mode of reading the input stream

Single mode

Server address, password and command to server must be specified in flags at startup. Example:

./rcon -a 127.0.0.1:16260 -p mypassword -c help

If arguments are passed they will sent as a single command. The response will displayed, and the CLI will exit.

Interactive input stream mode

To run CLI in interactive mode run rcon without -c argument. Example:

./rcon -a 127.0.0.1:16260 -p mypassword

Use ^C to terminate or type command :q to exit.

Configuration file

For more convenient use, the ability to create the rcon.yaml configuration file is provided. You can save the address of the remote server and its password. If the configuration file exists, and in it the default block is filled, then at startup the -a and -p flags can be omitted. Examples:

./rcon -a 127.0.0.1:16260 -c players
./rcon -c status
./rcon -p mypassword
./rcon 

Default configuration file name is rcon.yaml. File must be saved in yaml format. It is also possible to set the environment name and connection parameters for each server. You can enable logging requests and responses. To do this, you need to define the log variable in the environment blocks. You can do this for each server separately and create different log files for them. If the path to the log file is not specified, then logging will not be conducted. You cannot control this in arguments, it is available only from the configuration file.

default:
  address: "127.0.0.1:16260"
  password: "password"
  log: "rcon-default.log"
zomboid:
  address: "127.0.0.1:16260"
  password: "password"
  log: "rcon-zomboid.log"
rust:
  address: "127.0.0.1:28003"
  password: "password"  

You can choose the environment at the start:

./rcon -e rust -c status
./rcon -e zomboid

And set custom config file

./rcon --cfg /path/to/config/file.yaml

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL