Keyboard shortcuts

Press โ† or โ†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

proxy

Control auto-rotating proxy scheduling via the daemon.

xrat proxy <action> [flags]

All proxy actions require a running daemon:

xrat daemon start

Actions

ActionDescription
startEnable automatic proxy rotation on a fixed schedule
statusShow the current proxy rotation status
rotateTrigger an immediate manual rotation
stopDisable automatic proxy rotation

proxy start

Enable automatic proxy rotation on a fixed schedule.

xrat proxy start

Flags

No command-specific flags.

Behavior

  1. Sends a request to the daemon via IPC
  2. Daemon enables the rotation scheduler with settings from config.toml:
[runtime.rotation]
enabled = true
interval_secs = 1800
health_trigger_enabled = true
cooldown_secs = 300
test_concurrency = 0
test_stages = ["real_delay", "download"]
  1. Daemon begins periodic rotation according to the interval

Rotation Triggers

TriggerDescription
TimerScheduled rotation every interval_secs
Health checkTriggered when proxy health check fails (if health_trigger_enabled)
ManualTriggered by xrat proxy rotate

Cooldown

After a rotation, the daemon waits cooldown_secs before allowing another rotation. This prevents rapid switching when multiple triggers fire.


proxy status

Show the current proxy rotation status.

xrat proxy status [flags]

Flags

FlagDescription
--jsonPrint rotation status as JSON

Output

Proxy Rotation Status
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Enabled:        yes
Interval:       1800s
Last rotation:  2026-05-28 10:30:00 (manual)
Next rotation:  2026-05-28 11:00:00
Cooldown:       300s (inactive)
Active config:  42 (vless://example.com:443)

JSON Output

{
  "enabled": true,
  "interval_secs": 1800,
  "last_trigger": "manual",
  "last_rotation_at": "2026-05-28T10:30:00Z",
  "next_rotation_at": "2026-05-28T11:00:00Z",
  "cooldown_secs": 300,
  "cooldown_active": false,
  "active_config_id": 42
}

proxy rotate

Trigger an immediate manual rotation.

xrat proxy rotate [flags]

Flags

FlagDescription
--config-id <id>Force rotation to a specific enabled config ID

Examples

Rotate to the best candidate automatically:

xrat proxy rotate

Rotate to a specific config:

xrat proxy rotate --config-id 99

Behavior

  1. If --config-id is provided, rotates to that specific config
  2. Otherwise, selects the best candidate from enabled configs:
    • Tests candidates using test_stages from config.toml
    • Picks the config with the lowest real-delay latency
  3. Atomically disconnects the old session and connects the new one
  4. Respects cooldown period (rotation is delayed if cooldown is active)

Candidate Selection

When rotating without --config-id:

  1. Loads all enabled configs from the database
  2. Excludes the currently active config
  3. Tests candidates concurrently (up to test_concurrency workers)
  4. Filters out configs that fail any test stage
  5. Sorts by real-delay latency (lowest first)
  6. Selects the top candidate

proxy stop

Disable automatic proxy rotation.

xrat proxy stop

Flags

No command-specific flags.

Behavior

  1. Sends a request to the daemon via IPC
  2. Daemon disables the rotation scheduler
  3. Active proxy session continues running (not disconnected)
  • daemon โ€” daemon must be running for proxy commands to work
  • connect โ€” start one proxy session through the daemon
  • test โ€” test configs before enabling rotation