Features
xrat provides a comprehensive set of features for managing proxy configurations and running local proxy services.
Core Features
| Feature | Description |
|---|---|
| Importing | Import subscriptions from URLs, files, raw text, base64, JSON |
| Testing | 5-stage probe pipeline with failure classification |
| Runtime Management | Connect lifecycle, session state, reattach |
| Daemon and IPC | Supervisor process with Unix socket IPC |
| Auto-Rotation | Scheduled proxy switching with cooldown |
| IP Scanning | TCP reachability scanning with persistence |
| HTTP API | RESTful API for config access and monitoring |
| Deduplication | Versioned 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.