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

test

Test connectivity and latency for stored configs.

xrat test [ref] [flags]

Arguments

ArgumentDescription
refConfig ref prefix. Omit to bulk-test matching configs

Filter Flags

When testing multiple configs (no ref specified):

FlagDescription
--enabled-onlyFilter: only enabled configs
--active-onlyFilter: only the active config
--subscription <ref>Filter: only configs from the given subscription ref prefix

Stage Skip Flags

FlagDescription
--skip-icmpSkip the ICMP ping stage
--skip-tcpSkip the TCP connectivity stage
--skip-real-delaySkip the real-delay (HTTP round-trip) stage
--skip-downloadSkip the download speed stage
--skip-uploadSkip the upload speed stage (disabled by default)

URL Override Flags

FlagDescription
--test-url <url>Override the URL used for real-delay checks
--download-url <url>Override the URL used for download speed checks
--upload-url <url>Enable upload speed stage and set the HTTP POST target URL

Timeout Override Flags

FlagDescription
--icmp-timeout <ms>Override ICMP timeout in milliseconds
--tcp-timeout <ms>Override TCP connect timeout in milliseconds
--real-delay-timeout <ms>Override real-delay HTTP request timeout in milliseconds
--download-timeout <ms>Override download speed request timeout in milliseconds
--upload-timeout <ms>Override upload speed request timeout in milliseconds

Concurrency and Output Flags

FlagDescription
--concurrency <n>Bulk-test concurrency. 0 = auto-detect
--format <format>Output format: table, tsv, csv, json (default: table)
--output <file>Write bulk results to a file instead of stdout
--sort-by <field>Sort order: status, icmp, real-delay, download-speed, protocol, address (default: status)
--no-progressHide the animated progress bar

Ping Loop Flags

FlagDescription
--pingContinuously ping one config until Ctrl+C, printing a live summary
--ping-interval <ms>Interval between ping-loop iterations (default: 1000)

Historical Summary Flags

FlagDescription
--latest-run-summaryPrint a summary of the latest persisted test run and exit
--country <iso>Filter latest-run summary by endpoint country ISO code (e.g. US, DE)
--asn <filter>Filter latest-run summary by ASN (case-insensitive substring match)

Test Stages

The test command can record up to 5 probe result types:

StageMeasuresDefault
ICMPICMP ping success and latencyEnabled
TCPTCP connect success and latencyEnabled
Real DelayHTTP round-trip latency through proxyEnabled
DownloadDownload throughput through proxyDisabled
UploadUpload throughput through proxyDisabled

Stage Order

The default order for ICMP, TCP, real-delay, and download is configurable via config.toml. TCP is opt-in as a standalone stage; without it in order, TCP still runs as an implicit gate before real-delay when [testing.tcp].enabled is true.

[testing]
order = ["icmp", "real_delay", "download"]

TCP is used as a gate before real-delay when enabled. Upload runs after download only when --upload-url <url> is provided; there is no [testing.upload] config section.

Failure Policy

Controls behavior when a stage fails:

[testing]
failure_policy = "continue"  # "continue" | "skip_remaining" | "mark_failed"

Examples

Test a single config:

xrat test a1b2

Bulk-test all enabled configs with 4 workers:

xrat test --enabled-only --concurrency 4

Test with custom URLs and timeouts:

xrat test a1b2 \
  --test-url https://example.com/generate_204 \
  --download-url https://example.com/10mb.test \
  --real-delay-timeout 5000 \
  --download-timeout 15000

Skip ICMP and download stages:

xrat test a1b2 --skip-icmp --skip-download

Export results to CSV:

xrat test --enabled-only --format csv --output results.csv

Continuous ping loop:

xrat test a1b2 --ping --ping-interval 2000

View latest test run summary:

xrat test --latest-run-summary

Filter by country and ASN:

xrat test --latest-run-summary --country US --asn cloudflare

Output Formats

Table (default)

Aligned human-readable table for terminal use.

TSV

Tab-separated values for scripts:

ref	name	protocol	address	port	icmp_ms	real_delay_ms	download_mbps	upload_mbps	status	error
a1b2c3d4	Primary	vless	example.com	443	15	145			ok
f00d1234	Edge	vmess	edge.com	8443					failed	timeout

CSV

Comma-separated values, spreadsheet compatible.

JSON

Machine-parseable JSON array with full test result details.

Dial-endpoint GeoIP columns

When GeoIP is enabled, each tested config records geolocation for the address it dials. These columns appear only when at least one tested config resolved GeoIP data, so non-GeoIP runs stay compact.

OutputColumns shown
tableCOUNTRY, FRONTING
tsv, csvdial_endpoint_country, dial_endpoint_location, dial_endpoint_asn, dial_endpoint_fronting, dial_endpoint_geoip_source

These describe the dial endpoint — the address xrat connects to first — not a verified proxy origin. When the dialed address is behind a CDN or relay, the country and ASN belong to that fronting provider, and dial_endpoint_fronting names the detected provider (a hint, not proof of the backend location). dial_endpoint_geoip_source records lookup provenance: literal_ip when the config dialed a literal IP, dial_dns when a hostname was resolved via DNS.

Failure Classification

Test failures are classified into categories:

CategoryDescription
DNSDNS resolution failed
TimeoutConnection or request timed out
RefusedConnection refused
UnreachableNetwork unreachable
PermissionDeniedPermission denied
TLSTLS handshake failed
AuthAuthentication failed
ProcessProxy process failed to start
ProxyProxy returned an error
UnknownUnclassified failure