rcon

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rcon provides a Factorio-aware wrapper around a Source RCON connection. It serializes access, connects lazily, and transparently reconnects+retries once when the connection drops.

Index

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 is a serialized, self-healing RCON client.

func New

func New(cfg config.Config) *Client

New constructs a Client. It does not connect; the first Execute does.

func (*Client) Close

func (c *Client) Close() error

Close releases the underlying connection, if any.

func (*Client) Execute

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

Execute sends a single command and returns the response body. It connects lazily and, if the live connection has dropped, reconnects once and retries the command a single time before surfacing an *ErrConnection.

type ErrConnection

type ErrConnection struct{ Err error }

ErrConnection indicates the RCON endpoint could not be reached or the command could not be delivered after a reconnect attempt.

func (*ErrConnection) Error

func (e *ErrConnection) Error() string

func (*ErrConnection) Unwrap

func (e *ErrConnection) Unwrap() error

type Executor

type Executor interface {
	Execute(ctx context.Context, command string) (string, error)
}

Executor is the minimal surface the rest of the program depends on, which makes it trivial to substitute a fake in tests.

Jump to

Keyboard shortcuts

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