Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBattlEyePacket marks a datagram that is not a well-formed BattlEye packet. // It is never returned to the caller: the read loops skip such datagrams, because a UDP // socket can receive unrelated traffic. ErrInvalidBattlEyePacket = errors.New("invalid battleye packet") // ErrBattlEyeIncompleteResponse is returned when the parts of a multi-packet reply do not // all arrive within the timeout. ErrBattlEyeIncompleteResponse = errors.New("battleye response is incomplete") )
var ( // ErrRconDisabled is returned when the server answers that no RCON password is configured, // so remote console is switched off rather than merely rejecting our credentials. ErrRconDisabled = errors.New("rcon is not enabled on the server") // ErrPasswordContainsWhitespace rejects a password the id Tech protocols cannot express. // The server locates the command by walking to the first space after the password, so a // password containing whitespace would push part of itself into the command position and // execute something the caller never asked for. ErrPasswordContainsWhitespace = errors.New("rcon password must not contain whitespace") )
var ( // ErrSAMPRequiresIPv4 is returned when the server address does not resolve to IPv4. The // protocol embeds the four address octets in every packet, so IPv6 cannot be expressed. ErrSAMPRequiresIPv4 = errors.New("samp rcon requires an IPv4 server address") // ErrSAMPPingMismatch is returned when the server's ping reply does not echo our payload. ErrSAMPPingMismatch = errors.New("samp server did not echo the ping payload") // ErrSAMPFieldTooLong is returned when a password or command exceeds the 16-bit length // prefix the protocol uses. ErrSAMPFieldTooLong = errors.New("samp rcon field exceeds the maximum length") )
var ( ErrAuthenticationFailed = errors.New("authentication failed") ErrInvalidPacket = errors.New("invalid packet") )
var (
ErrInvalidChallengeResponse = errors.New("invalid challenge response")
)
var (
ErrUnsupportedProtocol = errors.New("unsupported protocol")
)
Functions ¶
func IsProtocolSupported ¶
Types ¶
type BattlEye ¶
type BattlEye struct {
// contains filtered or unexported fields
}
BattlEye implements the BattlEye RCon protocol used by Arma 2, Arma 3, DayZ, SCUM and Arma Reforger. Unlike the id Tech protocols it is a real session: the client logs in, then numbers its commands, and the server can push unsolicited messages at any time.
The protocol also requires an empty command packet at least every 45 seconds to keep a login alive. No keepalive is implemented here on purpose — the panel opens a connection, runs one command and closes it within a couple of seconds per request. Anyone reusing a client across requests (for example by wiring pool.go) must add one, and must also stop relying on drainStaleDatagrams, which discards unacknowledged server messages.
func NewBattlEye ¶
type Client ¶
type GoldSource ¶
type GoldSource struct {
// contains filtered or unexported fields
}
func NewGoldSource ¶
func NewGoldSource(config Config) (*GoldSource, error)
func (*GoldSource) Close ¶
func (g *GoldSource) Close() error
type PooledClient ¶
type PooledClient struct {
// contains filtered or unexported fields
}
func (*PooledClient) Close ¶
func (c *PooledClient) Close() (err error)
type Quake ¶
type Quake struct {
// contains filtered or unexported fields
}
Quake implements RCON for the id Tech 2 and id Tech 3 engine families: Quake 2, Quake 3 Arena, Quake Live, Return to Castle Wolfenstein, Wolfenstein: Enemy Territory, the Call of Duty series and the ioquake3 derivatives.
The wire format is a single connectionless UDP datagram in each direction; there is no handshake and no session, so Open only dials. Large replies arrive as several datagrams because the server flushes its redirect buffer in ~1 KiB chunks.
func (*Quake) Open ¶
Open dials the server. The protocol is stateless and carries the password on every command, so there is nothing to authenticate here — a wrong password surfaces from Execute. Probing with a throw-away command is deliberately avoided: vanilla Quake 3 throttles RCON to one packet per 500 ms server-wide and would silently drop the real command that follows.
type SAMP ¶
type SAMP struct {
// contains filtered or unexported fields
}
SAMP implements RCON for SA-MP and open.mp servers. The remote console shares the UDP query port and reuses the query framing: every packet starts with the eleven-byte header, and the server answers with one datagram per console output line.
Most SA-MP console commands print nothing at all, and `players` prints nothing on an empty server, so silence after a command is a normal empty response rather than an error. Open therefore performs a ping handshake, which is what establishes that the server is reachable.