Documentation
¶
Overview ¶
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
gorcon version 14.1.13 (lee8oi)
gorcon package contains the essential functions needed for, connecting to & running commands on, BF2CC based Rcon servers.
Index ¶
- type Config
- type Rcon
- func (r *Rcon) AutoReconnect(wait string)
- func (r *Rcon) Connect(address string) (err error)
- func (r *Rcon) Enqueue(line string)
- func (r *Rcon) Handler(f func(string))
- func (r *Rcon) Init()
- func (r *Rcon) Login(admin, pass string) (err error)
- func (r *Rcon) Queue(dur time.Duration)
- func (r *Rcon) Reader()
- func (r *Rcon) Reconnect() error
- func (r *Rcon) Scan(str string) (s string)
- func (r *Rcon) Send(command string) (string, error)
- func (r *Rcon) Write(message string)
- func (r *Rcon) Writer()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rcon ¶
type Rcon struct {
// contains filtered or unexported fields
}
func (*Rcon) AutoReconnect ¶
AutoReconnect enables reconnection. Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h" (see time.ParseDuration doc).
func (*Rcon) Connect ¶
Connect establishes connection to specified address and stores encryption seed used by Login().
func (*Rcon) Enqueue ¶
Enqueue adds a command line to the Queue to be written to the Rcon connection via Writer.
func (*Rcon) Handler ¶
Handler listens on the receive channel for data from the Reader. Runs the given function on the resulting string data.
func (*Rcon) Init ¶
func (r *Rcon) Init()
Init initializes Reader & Writer routines. Also initializes necessary channels and starts the Queue for handling outgoing commands with Enqueue().
func (*Rcon) Queue ¶
Queue sequentially handles outgoing commands being sent to the Rcon connection. Waits duration before processing next item in queue.
func (*Rcon) Reader ¶
func (r *Rcon) Reader()
Reader reads all incoming socket data and sends it to the receiving channel. Includes reconnection on connect errors.
func (*Rcon) Reconnect ¶
Reconnect attempts to re-establish Rcon connection. Waiting duration & trying again on failure.
func (*Rcon) Send ¶
Send is a synchronous style function, independant of the Reader & Writer, used to write a command to the socket and returning the resulting data as a string. Includes reconnection on connect errors.