Documentation
¶
Index ¶
Constants ¶
const ( ProtocolRCON = "rcon" ProtocolTELNET = "telnet" ProtocolWebRCON = "web" )
Allowed protocols.
const DefaultConfigEnv = "default"
DefaultConfigEnv is the name of the environment, which is taken as default unless another value is passed.
const DefaultConfigName = "rcon.yaml"
DefaultConfigName sets the default config file name.
const DefaultProtocol = ProtocolRCON
DefaultProtocol contains the default protocol for connecting to a remote server.
const DefaultTimeout = 10 * time.Second
DefaultTimeout contains the default dial and execute timeout.
Variables ¶
var ( // ErrConfigValidation is when config validation completed with errors. ErrConfigValidation = errors.New("config validation error") // ErrUnsupportedFileExt is returned when config file has an unsupported // extension. Allowed extensions is `.json`, `.yml`, `.yaml`. ErrUnsupportedFileExt = errors.New("unsupported file extension") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config allows to take a remote server address and password from the configuration file. This enables not to specify these flags when running the CLI.
Example: ```yaml default:
address: "127.0.0.1:16260" password: "password"
```.
func NewConfig ¶ added in v0.9.0
NewConfig finds and parses config file with remote server credentials.
func (*Config) ParseFromFile ¶ added in v0.9.0
ParseFromFile reads a configuration file from disk and loads its contents into the application's config structure. YAML and JSON files are supported.
type Session ¶ added in v0.9.0
type Session struct {
Address string `json:"address" yaml:"address"`
Password string `json:"password" yaml:"password"`
// Log is the name of the file to which requests will be logged.
// If not specified, no logging will be performed.
Log string `json:"log" yaml:"log"`
Type string `json:"type" yaml:"type"`
SkipErrors bool `json:"skip_errors" yaml:"skip_errors"`
Timeout time.Duration `json:"timeout" yaml:"timeout"`
}
Session contains details for making a request on a remote server.