feat: Add WebSocket RCON client to companion agent
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Wire gorilla/websocket into the Go companion agent to send arbitrary
console commands (e.g. oxide.reload BetterLoot) to the Rust Dedicated
Server's WebRCON endpoint. Adds RCON_PORT and RCON_PASSWORD env vars,
a new "command" action on the existing cmd.server NATS subject, and
the internal/rcon package that handles the JSON-over-WebSocket protocol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-02-22 00:16:47 -05:00
parent f67b175d39
commit eb57c51a24
5 changed files with 113 additions and 1 deletions

View File

@@ -31,6 +31,10 @@ type Config struct {
// Install directory for deployment
InstallDir string `envconfig:"INSTALL_DIR" default:""`
// RCON configuration
RconPort int `envconfig:"RCON_PORT" default:"28016"`
RconPassword string `envconfig:"RCON_PASSWORD" default:""`
// Optional settings
HeartbeatInterval int `envconfig:"HEARTBEAT_INTERVAL" default:"60"`
LogLevel string `envconfig:"LOG_LEVEL" default:"info"`
@@ -63,6 +67,7 @@ func main() {
log.Printf(" Game Server Path: %s", cfg.GameServerPath)
log.Printf(" SteamCMD Path: %s", cfg.SteamCMDPath)
log.Printf(" Install Dir: %s", cfg.InstallDir)
log.Printf(" RCON Port: %d", cfg.RconPort)
log.Printf(" Heartbeat Interval: %ds", cfg.HeartbeatInterval)
// Create context with signal handling for graceful shutdown
@@ -88,6 +93,8 @@ func main() {
GameServerArgs: cfg.GameServerArgs,
Version: version,
InstallDir: cfg.InstallDir,
RconPort: cfg.RconPort,
RconPassword: cfg.RconPassword,
}
// Start daemon