Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RustWarden

A professional-grade RCON administration client for Rust Console Edition servers, written in Go with minimal external dependencies.

Built from the ground up with a custom WebSocket implementation — no Gorilla WebSockets, no bloat.

Features

Core functionality:

  • Connect to Rust Console Edition servers via WebRcon protocol
  • Interactive command line interface with raw terminal mode
  • One-shot mode for automated scripts (-cmd flag)
  • Config file support (config.txt) for persistent server settings

Resilience:

  • Auto-reconnect with exponential backoff (1s → 30s cap)
  • Command queueing during disconnection — queued commands execute on reconnection
  • Countdown timer displayed during reconnect attempts
  • Graceful shutdown on Ctrl+C or disconnect

User experience:

  • Interruption-safe input — server events don't destroy your typed commands
  • Raw terminal mode with live redraw (backspace, prompt preservation)
  • Quiet mode (-quiet) to suppress server events, show only command responses
  • Cross-platform: Windows, Linux, macOS

Extensible architecture:

  • Custom WebSocket transport layer — no Gorilla, full control over frame handling
  • RCON protocol layer with response routing by identifier
  • Event broadcasting for unsolicited server messages (chat, player joins, etc.)

Requirements

  • Go 1.21 or later
  • A Rust Console Edition server with WebRcon enabled

Installation

Clone and build:

git clone https://github.com/lee8oi/rustwarden.git
cd rustwarden
go mod init rustwarden
go mod tidy
go build -o rustwarden.exe .        # Windows
go build -o rustwarden              # Linux/macOS

Usage

Command-line flags

Flag Required Description
-host Yes Server IP address or hostname
-port Yes RCON port (typically 28016)
-password Yes Server RCON password
-cmd No Send a single command and exit (one-shot mode)
-quiet No Suppress server events, show only command responses

Examples

Basic connection:

./rustwarden.exe -host 192.168.1.100 -port 28016 -password secret

One-shot command (automated):

./rustwarden.exe -host 192.168.1.100 -port 28016 -password secret -cmd "status"

Quiet mode (minimal output):

./rustwarden.exe -host 192.168.1.100 -port 28016 -password secret -quiet

Configuration file (optional)

Create config.txt in the working directory:

# Server configuration
host=192.168.1.100
port=28016
password=secret

Lines starting with # are comments. Flags override config values if both are provided.

Behavior

During disconnection:

> say hello
[queued #42] say hello

[status] Connection lost.
[status] Retrying in 1s...
[status] Retrying in 2s...
[status] Connecting...
[status] Reconnected!

[queued #42] Hello world

Server events (non-quiet mode):

> status
Online players: 12

[event] PlayerName: hi there
> kick PlayerName

[status] Connection lost.
[status] Retrying in 1s...

Quiet mode (events suppressed):

> status
Online players: 12

[status] Connection lost.
[status] Retrying in 1s...

Architecture

Three-layer design:

  1. Transport (ws.go) — Pure stdlib WebSocket implementation. Handles handshakes, frame masking/unmasking, fragmentation reassembly, control frames. Dependencies: net, crypto/rand, crypto/sha1, encoding/binary, bufio.

  2. Protocol (rcon.go) — RCON command/response layer. Manages command identifiers, routes responses to pending requests, handles unsolicited messages, manages reconnect logic with exponential backoff.

  3. Application (main.go) — CLI interface. Parses flags/config, handles raw terminal input via golang.org/x/term, manages user interaction, displays status and events.

Limitations

  • Plain WebSocket only — Rust Console Edition servers do not support wss:// (secure WebSocket). Traffic including passwords travels unencrypted. For secure connections, use SSH tunneling or a VPN.
  • Single server session — Connects to one server at a time. Multi-server support planned.

Planned features

  • Command history (arrow up/down to recall previous commands)
  • Tab completion for common Rust admin commands
  • Scripted command execution from files
  • Scheduled commands (e.g., periodic save or restart warnings)
  • Session logging to file
  • Colored output for events, commands, errors

Contributing

Contributions are welcome. Submit issues and pull requests.

License

MIT License. See LICENSE for details.


Note: Rust Console Edition WebRcon uses plain WebSocket only. Facepunch has not implemented WSS support. See Facepunch/webrcon#39.

About

A professional-grade RCON administration client for Rust Console Edition servers, written in Go with minimal external dependencies.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages