Documentation
¶
Index ¶
- type Client
- func (c Client) CountPlayers(ctx context.Context) (int, error)
- func (c Client) Players(ctx context.Context) (int, []string, error)
- func (c Client) Restart(ctx context.Context) error
- func (c Client) SendCommand(ctx context.Context, command string) (rcon.Message, error)
- func (c Client) SendMessage(ctx context.Context, msg string) error
- func (c Client) Setup(address string, password string) (Client, error)
- func (c Client) Whitelist(ctx context.Context, username string) error
- type CommandSender
- type ReconnectingRCON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a RCON connection exposing required features
func (Client) CountPlayers ¶
CountPlayers returns the number of players returned by the RCON list command
func (Client) Players ¶
Players returns the number of players and their names as returned by the RCON list command
func (Client) SendCommand ¶
SendCommand to the server via RCON
func (Client) SendMessage ¶
SendMessage to the server via RCON
type CommandSender ¶
type CommandSender interface {
SendCommand(ctx context.Context, command string) (rcon.Message, error)
}
CommandSender defines the minimal interface for sending RCON Commands
type ReconnectingRCON ¶
type ReconnectingRCON struct {
// contains filtered or unexported fields
}
ReconnectingRCON wraps a RCON client reconnecting it on connection errors
func NewReconnectingRCON ¶
func NewReconnectingRCON(address, password string) *ReconnectingRCON
NewReconnectingRCON for the provided address and password
func (*ReconnectingRCON) Reconnect ¶
func (c *ReconnectingRCON) Reconnect(ctx context.Context) error
Reconnect the session
func (*ReconnectingRCON) SendCommand ¶
SendCommand reconnecting the underlying session on any permanent connection errors
func (*ReconnectingRCON) Setup ¶
func (c *ReconnectingRCON) Setup() error
Setup establishes the initial connection and authenticates the session