client

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package client provides a typed Go client for interacting with a factop server over NATS. It handles the RCON-over-NATS connection and provides the base for command-specific sub-packages.

Convention: each softmod/factop/<name>.lua that registers custom commands gets a corresponding client/<name>/ package. The Lua file defines the server-side commands; the Go package provides the typed client methods.

softmod/factop/tiles.lua  →  client/tiles/  (TilesClient)
softmod/factop/foo.lua    →  client/foo/    (FooClient)

All sub-packages accept a *client.Conn and use its Rcon method to send commands to the factop server.

Index

Constants

View Source
const (
	DefaultTimeout = 10 * time.Second
	RconSubject    = "factop.rcon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn wraps a NATS connection for communicating with a factop server.

func Dial

func Dial(natsURL string, opts ...Option) (*Conn, error)

Dial connects to the NATS server at the given URL and returns a Conn.

func (*Conn) Close

func (c *Conn) Close()

Close closes the underlying NATS connection.

func (*Conn) Rcon

func (c *Conn) Rcon(command string) (string, error)

Rcon sends a raw RCON command string to the factop server and returns the response. This is the low-level method used by all sub-packages.

type Option

type Option func(*Conn)

Option configures a Conn.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the RCON request timeout.

Directories

Path Synopsis
Package entity provides a typed Go client for the entity manipulation commands registered by softmod/factop/entity.lua.
Package entity provides a typed Go client for the entity manipulation commands registered by softmod/factop/entity.lua.
Package game provides a typed Go client for the server administration commands registered by softmod/factop/game.lua.
Package game provides a typed Go client for the server administration commands registered by softmod/factop/game.lua.
Package player provides a typed Go client for the player manipulation commands registered by softmod/factop/player.lua.
Package player provides a typed Go client for the player manipulation commands registered by softmod/factop/player.lua.
Package playerattr provides a typed Go client for the per-player key-value attribute commands registered by softmod/factop/playerattr.lua.
Package playerattr provides a typed Go client for the per-player key-value attribute commands registered by softmod/factop/playerattr.lua.
Package resource provides a typed Go client for the resource and pollution commands registered by softmod/factop/resource.lua.
Package resource provides a typed Go client for the resource and pollution commands registered by softmod/factop/resource.lua.
Package surface provides a typed Go client for the surface property and chunk management commands registered by softmod/factop/surface.lua.
Package surface provides a typed Go client for the surface property and chunk management commands registered by softmod/factop/surface.lua.
Package tile provides a typed Go client for the tile manipulation commands registered by softmod/factop/tile.lua.
Package tile provides a typed Go client for the tile manipulation commands registered by softmod/factop/tile.lua.

Jump to

Keyboard shortcuts

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