rcon

package
v3.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotConnected means the client attempted to send data but there was no connection to the server
	ErrNotConnected = errors.New("rcon: not connected to the server")
	// ErrAlreadyLoggedIn means the RCON client was already logged in but a second login attempt was made
	ErrAlreadyLoggedIn = errors.New("rcon: already successfully logged in")
	// ErrInvalidPassword means the password used in the RCON login was incorrect
	ErrInvalidPassword = errors.New("rcon: incorrect password")
	// ErrNotAuthenticated means the client attempted to execute a command before a login was successful
	ErrNotAuthenticated = errors.New("rcon: not authenticated with the server")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Messages chan string
	// contains filtered or unexported fields
}

Client is a client for interacting with RCON and contains multiple methods

func Connect

func Connect(host string, port uint16, options ...options.RCON) (*Client, error)

Connect connects to the server using the address provided and returns a new client

func (*Client) Close

func (r *Client) Close() error

Close closes the connection to the server

func (*Client) Execute added in v3.4.0

func (r *Client) Execute(ctx context.Context, command string) (string, error)

Execute runs the command on the server and attempts to wait for a response

func (*Client) Login

func (r *Client) Login(password string) error

Login communicates authentication with the server using the plaintext password

func (*Client) Run

func (r *Client) Run(command string) error

Run executes the command on the server but does not wait for a response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL