Manage the local proxy runtime through the daemon: connect, disconnect, and check status.
Start a managed proxy runtime for a stored config.
xrat connect [ref] [flags]| Argument | Description |
|---|---|
ref |
Config ref prefix, ID, or latest to start as the active session. Defaults to the last connected config if omitted |
| Flag | Description |
|---|---|
--json |
Print the result as JSON |
xrat connect a1b2xrat connect a1b2c3d4 --json- Sends a runtime-connect request to the daemon over local IPC
- The daemon loads the config from the database
- Generates an Xray (or V2Ray) runtime config with local inbounds
- Spawns the proxy process
- Waits for the SOCKS port to become ready
- Persists a
runtime_sessionsrecord with statusrunning - Prints connection details
If the daemon is not running, start it first:
xrat daemon start| Protocol | Host | Port | Notes |
|---|---|---|---|
| SOCKS5 | 0.0.0.0 |
18200 |
UDP support enabled by default |
| HTTP | 0.0.0.0 |
18201 |
Disabled by default in config.toml |
| Shadowsocks | 0.0.0.0 |
18202 |
Disabled by default, aes-128-gcm |
Configure inbounds in config.toml under [runtime.socks], [runtime.http],
and [runtime.shadowsocks].
If replace_active_session = true in config.toml, connecting to a new config
automatically disconnects the previous session.
The managed runtime uses the configured engine. Hysteria2 (hy2) runs through
native Xray when [runtime].engine = "xray", or sing-box when the engine is
sing-box; V2Ray rejects it. Xray rejects Hy2 URI options it cannot represent
before launch. Setting [runtime].engine = "sing-box" for non-Hysteria2 configs
currently returns a clear unsupported-combination error.
Stop the active managed proxy runtime.
xrat disconnect [flags]| Flag | Description |
|---|---|
--json |
Print the result as JSON |
xrat disconnect- Sends a runtime-disconnect request to the daemon over local IPC
- The daemon sends SIGTERM to the running proxy process
- Waits up to 5 seconds for graceful shutdown
- Sends SIGKILL if the process is still running
- Updates the session status to
stopped - Cleans up temporary config files
Show the managed proxy runtime status.
xrat status [flags]| Flag | Description |
|---|---|
--json |
Print the status as JSON |
xrat statusxrat status --jsonDisplays:
- Session state:
starting,running,stopping,stopped,failed - Config details: protocol, address, port, name
- Process info: PID, liveness check
- Inbound health: TCP reachability of SOCKS, HTTP, Shadowsocks ports
- Uptime: time since session started
If no daemon is reachable, the command exits with a hint to run
xrat daemon start.
{
"status": "running",
"session_id": 5,
"session_config": {
"ref": "a1b2c3d4e5f6"
},
"protocol": "vless",
"address": "example.com",
"port": 443,
"pid": 12345,
"pid_alive": true,
"socks_port": 18200,
"socks_reachable": true,
"http_port": 18201,
"http_reachable": false,
"started_at": "2026-05-28T10:30:00Z"
}