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

Features

xrat provides a comprehensive set of features for managing proxy configurations and running local proxy services.

Core Features

FeatureDescription
ImportingImport subscriptions from URLs, files, raw text, base64, JSON
Testing5-stage probe pipeline with failure classification
Runtime ManagementConnect lifecycle, session state, reattach
Daemon and IPCSupervisor process with Unix socket IPC
Auto-RotationScheduled proxy switching with cooldown
IP ScanningTCP reachability scanning with persistence
HTTP APIRESTful API for config access and monitoring
DeduplicationVersioned dedup keys for config uniqueness

Feature Highlights

Multi-Protocol Support

xrat supports 7 proxy protocols:

  • VLESS โ€” modern, lightweight protocol
  • VMess โ€” legacy protocol with encryption
  • Shadowsocks โ€” simple SOCKS5-like proxy
  • Trojan โ€” TLS-based proxy that mimics HTTPS
  • HTTP/HTTPS โ€” standard HTTP proxy
  • SOCKS5 โ€” classic SOCKS protocol
  • Hysteria2 โ€” QUIC-based protocol (via sing-box)

Dual Database Backend

  • SQLite โ€” single-user, file-based, zero configuration
  • PostgreSQL โ€” multi-user, connection pooling, production-ready

Engine Support

  • Xray-core/V2Ray โ€” managed runtime engines used by xrat connect
  • sing-box โ€” parse-time and runtime-config preview support, including Hysteria2 diagnostics through xrat parse --engine sing-box

Configurable Testing Pipeline

  • 5 test stages: ICMP, TCP, real-delay, download, upload
  • Configurable stage order and failure policy
  • Bulk testing with concurrency control
  • Failure classification with 10 categories
  • GeoIP enrichment for endpoint metadata

Managed Runtime

  • Automatic proxy process lifecycle management
  • Session state tracking with database persistence
  • Graceful shutdown with SIGTERM/SIGKILL fallback
  • Stale session recovery on daemon restart

Daemon Supervisor

  • Long-lived background process
  • Unix domain socket IPC for CLI communication
  • Health monitoring with automatic rotation on failure
  • Scheduled rotation with cooldown protection

HTTP API

  • RESTful endpoints for config access
  • Base64 subscription output for mobile clients
  • Optional API key authentication
  • Paginated config listing with filters

Architecture

See Architecture for details on how these features are implemented.