Documentation ¶
Overview ¶
Package rcon provides a golang interface of Source Remote Console (RCON) client, let server operators to administer and interact with their servers remotely in the same manner as the console provided by srcds. Based on http://developer.valvesoftware.com/wiki/Source_RCON_Protocol
Index ¶
Constants ¶
const ( // DefaultAddress of the srcds RCON DefaultAddress = "127.0.0.1:27015" // DefaultPassword is empty DefaultPassword = "" // DefaultTimeout of the connection DefaultTimeout = time.Second * 1 )
Variables ¶
var ( ErrNoConnection = errors.New("no connection") ErrDialTCPFail = errors.New("dial TCP fail") ErrConnectionClosed = errors.New("connection closed") ErrBadPassword = errors.New("bad password") ErrInvalidResponse = errors.New("invalid response") ErrCrapBytes = errors.New("response contains crap bytes") ErrWaitingTimeout = errors.New("timeout while waiting for reply") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client of RCON protocol to srcds Remember to set Timeout, it will block forever when not set
func (*Client) Execute ¶
Execute the command. Execute once if no "\n" provided. Return result message and nil on success, empty string and an error on failure. If cmd includes "\n", it is treated as a script file. Splitted and trimmed into lines. Line starts with "//" will be treated as comment and ignored. When all commands seccess, concatted messages and nil will be returned. Once failed, concatted previous succeeded messages and an error will be returned.