routing-switch
System-wide traffic routing through various proxy protocols
Version: 9.0.1 | Size: 9.5MB | Author: Warith Al Maawali
License: Proprietary | Website: https://digi77.com
File Information
Property | Value |
---|---|
Binary Name | routing-switch |
Version | 9.0.1 |
Build Date | 2025-09-23T19:20:01.909677119Z |
Rust Version | 1.70.0 |
File Size | 9.5MB |
JSON Data | View Raw JSON |
SHA256 Checksum
Features
Feature | Description |
---|---|
Feature | System-wide traffic routing through proxy protocols |
Feature | Support for OpenVPN, WireGuard, and Dante SOCKS5 |
Feature | Support for Tor, Shadowsocks, V2Ray, and Xray protocols |
Feature | Support for Mieru/Mita and Hysteria2 protocols |
Feature | Automatic protocol scoring and selection |
Feature | DNS leak prevention with multiple modes |
Feature | Metric-based and direct routing options |
Feature | External configuration file support |
Feature | IPv4/IPv6 dual-stack support |
Feature | QR code generation for mobile clients |
Feature | Comprehensive logging and monitoring |
Global Options
Flag | Description |
---|---|
-h, --help |
Print help information |
-v, --version |
Print version information |
-n, --info |
Display detailed information |
-e, --examples |
Show usage examples |
--json |
Output in JSON format |
--json-pretty |
Pretty-print JSON output with indentation |
--json-human |
Enhanced JSON output with improved formatting (like jq) |
--verbose |
Enable verbose output |
Commands
CONNECTION COMMANDS
connect
Connect to a proxy protocol (openvpn, wireguard use native routing; tor uses redsocks; dante, shadowsocks, v2ray, xray-*, mita use tun2socks)
Usage:
disconnect
Disconnect current proxy connection
Usage:
status
Show current connection status
Usage:
INFORMATION COMMANDS
dns-info
Display current DNS server information
Usage:
list-protocols
List available protocols with scores
Usage:
TESTING COMMANDS
test-protocol
Test a specific protocol connectivity
Usage:
benchmark
Benchmark all available protocols
Usage:
CONFIGURATION COMMANDS
export-config
Export protocol configurations to files
Usage:
showconfig
Show protocol configuration
Usage:
showconfigurl
Show protocol configuration as URL
Usage:
showconfigqr
Show protocol configuration as QR code
Usage:
MANAGEMENT COMMANDS
auto-select
Auto-select and connect to best protocol
Usage:
reset
Reset all routing to default state
Usage:
cleanup
Clean up orphaned processes and resources
Usage:
recover
Recover from partial failure state
Usage:
Examples
BASIC CONNECTIONS
Connect to various proxy protocols
Connect via OpenVPN
Expected Output: Successfully connected to OpenVPN serverNote
Requires OpenVPN configuration in auth card
Connect via WireGuard
Expected Output: Successfully connected to WireGuard serverNote
Ultra-fast, modern VPN protocol
Connect via Dante SOCKS5 proxy
Expected Output: Successfully connected to Dante serverRoute ALL traffic through Tor network (uses redsocks)
Expected Output: Successfully routing traffic through TorNote
Maximum anonymity, slower speeds. Uses redsocks for stability instead of tun2socks
Connect via Shadowsocks
Expected Output: Successfully connected to Shadowsocks serverNote
Optimized for bypassing censorship
Connect via V2Ray VMess
Expected Output: Successfully connected to V2Ray serverConnect via Xray VLESS TLS
Expected Output: Successfully connected to Xray VLESS serverNote
Lightweight, fast protocol with TLS
Connect via Xray VLESS Reality
Expected Output: Successfully connected to Xray VLESS Reality serverNote
Most advanced censorship resistance
Connect via Xray Trojan
Expected Output: Successfully connected to Xray Trojan serverNote
Mimics HTTPS traffic
Connect via Xray VMess
Expected Output: Successfully connected to Xray VMess serverConnect via Mieru/Mita protocol
Expected Output: Successfully connected to Mita serverNote
Anti-censorship protocol
Connect via Hysteria2 protocol
Expected Output: Successfully connected to Hysteria2 serverNote
UDP-based, high-performance anti-censorship protocol
EXTERNAL CONFIGURATION FILES
Connect using external configuration files instead of auth card
Connect using external OpenVPN config file
Expected Output: Successfully connected to OpenVPN serverNote
Supports standard .ovpn configuration files
Connect using external WireGuard config
Expected Output: Successfully connected to WireGuard serverNote
Uses standard WireGuard .conf format
Connect using Shadowsocks JSON config
Expected Output: Successfully connected to Shadowsocks serverNote
Standard Shadowsocks JSON format with server, port, password, method
Connect using V2Ray JSON config
Expected Output: Successfully connected to V2Ray serverNote
Full V2Ray JSON configuration with inbounds/outbounds
Connect using Xray config file
Expected Output: Successfully connected to Xray VLESS serverNote
Xray JSON config format similar to V2Ray
Force connection with external config
Expected Output: Disconnecting existing... Connected via external configNote
Combines --config with other flags like --force
External config in no-TUN mode
Expected Output: Shadowsocks SOCKS5 proxy ready at localhost:30000Note
Use external config for manual proxy setup
IPV4/IPV6 SELECTION
Explicitly choose IPv4 or IPv6 connections
Force IPv4 connection to Dante
Expected Output: Connected via IPv4Force IPv6 connection to Dante
Expected Output: Connected via IPv6Note
Requires IPv6 support
Connect Shadowsocks over IPv4
Expected Output: Shadowsocks connected via IPv4Connect Tor over IPv6
Expected Output: Tor connected via IPv6Use IPv6 for Xray VLESS
Expected Output: Xray VLESS connected via IPv6Connect Hysteria2 over IPv4
Expected Output: Hysteria2 connected via IPv4Connect Hysteria2 over IPv6
Expected Output: Hysteria2 connected via IPv6Note
Requires IPv6 support
CONNECTION STATUS
Check and monitor connection status
Show current connection status
Expected Output: Protocol: wireguard, Status: ConnectedGet status in JSON format
Expected Output: {"protocol": "wireguard", "status": "connected"}Detailed connection information
Expected Output: Detailed connection stats and routing infoPretty-printed JSON status
Expected Output: Formatted JSON with connection detailsHuman-readable JSON status
Expected Output: Enhanced JSON output with descriptionsDNS MODES AND SECURITY
Control DNS routing for security and compatibility
Default auto mode (no special DNS routing)
Expected Output: DNS handled naturally through tunnelNote
Default safe mode - DNS flows through tunnel like all traffic
Hybrid mode: VPN server DNS bypasses tunnel
Expected Output: Using hybrid DNS mode: VPN server DNS bypasses, others through tunnelNote
Good balance of security and reliability
Strict mode: ALL DNS through tunnel
Expected Output: Using strict DNS mode: Maximum securityNote
Most secure, may fail if VPN server uses hostname
System mode: DNS bypasses tunnel
Expected Output: WARNING: System DNS mode - DNS queries will leak!Note
⚠️ NOT SECURE - DNS leaks! Use only for debugging
Exclude private networks from VPN
Expected Output: Private networks will bypass VPN tunnelNote
Keep LAN access while using VPN
Hybrid DNS with private network exclusion
Expected Output: Using hybrid DNS mode with local network accessNote
Good for home/office use when you need LAN access
ROUTING MODES - SECURITY vs FAILOVER
Choose between Direct (secure) or Metric (with fallback) routing
DEFAULT: Direct routing mode (MOST SECURE)
Expected Output: Using DIRECT routing: Traffic goes ONLY through TUN, no fallbackNote
✅ RECOMMENDED - Acts as kill switch, no leaks if VPN fails
Metric routing mode (LESS SECURE, has fallback)
Expected Output: Using METRIC routing: Original route kept as backupNote
⚠️ WARNING: Can leak traffic if TUN fails! Use only if you need failover
Direct mode for Shadowsocks (default)
Expected Output: Direct routing: No internet if Shadowsocks stopsNote
Perfect privacy - connection drops if proxy fails
Metric mode for corporate VPN scenarios
Expected Output: Metric routing: Fallback to original connection if VPN dropsNote
Use for work VPNs where you need automatic failover
Metric mode with LAN access preserved
Expected Output: Failover routing with local network bypassNote
Corporate setup: VPN with failover + LAN access
DISCONNECTION
Disconnect and restore normal routing
Disconnect current proxy
Expected Output: Successfully disconnectedForce disconnect even if issues
Expected Output: Force disconnectedNote
Kills all processes forcefully
Disconnect and clean all firewall rules
Expected Output: Disconnected and firewall rules cleanedNote
Use when network is stuck after disconnect due to lingering iptables rules
Force disconnect with complete firewall cleanup
Expected Output: Force disconnected, all firewall rules flushedNote
Emergency recovery - resets all iptables rules (preserves Docker/KVM chains)
Disconnect with JSON output
Expected Output: {"status": "disconnected"}Disconnect with detailed output
Expected Output: Stopping tun2socks... Restoring routes... DoneDisconnect with firewall cleanup and verbose output
Expected Output: Disconnecting... Flushing NAT table... Flushing filter table... Network connectivity verifiedNote
Shows detailed firewall cleanup process
FORCE FLAG & PROTOCOL COMPATIBILITY
Understanding --force behavior and which protocols can layer together
Creates LAYERED connection: Tor-over-WireGuard ✓
Expected Output: → Traffic flows through BOTH protocols (double encryption) → WireGuard's wg0 interface remains active → Tor's iptables rules redirect traffic on topNote
LAYERED: Both protocols remain active. Traffic: App → Tor (redsocks) → WireGuard → Internet
Creates LAYERED connection: Tor-over-OpenVPN ✓
Expected Output: → Traffic: Your App → Tor (redsocks) → OpenVPN (tun0) → Internet → Both protocols active simultaneouslyNote
Works because Tor uses iptables NAT, no interface conflict with OpenVPN's tun0
FAILS: Interface conflict ✗
Expected Output: → ERROR: Both protocols need the same tun_routing interface → Cannot have two tun2socks instances → Must disconnect firstNote
All tun2socks protocols (shadowsocks, dante, v2ray, xray-*, mita, hysteria2) share the same TUN device
May create complex routing (untested)
Expected Output: → Shadowsocks tun_routing remains → Tor adds iptables rules on top → Behavior depends on routing prioritiesNote
Different architectures (tun2socks vs iptables) - may work but not recommended
Understanding protocol architectures
Expected Output: → Native VPNs (own interfaces): openvpn (tun0), wireguard (wg0) → Redsocks (iptables NAT): tor → Tun2socks (shared tun_routing): shadowsocks, dante, v2ray, xray-vless, xray-vless-reality, xray-trojan, xray-vmess, mita, hysteria2Note
Compatible: Native+Tor. Incompatible: Any two tun2socks protocols
Best practices for using --force
Expected Output: → ✓ WireGuard/OpenVPN first, then Tor --force for double VPN → ✗ Never layer two tun2socks protocols → Test connectivity after layeringNote
--force allows connection despite existing protocol, but compatibility depends on architecture
DNS INFORMATION
Check DNS configuration
Show current DNS servers
Expected Output: IPv4:DNS info in JSON format
Expected Output: {"ipv4": {"host": "TOR DNS INFORMATION
Check Tor DNS and SOCKS configuration
Show Tor DNS and SOCKS endpoints
Expected Output: DNS: dns://Note
Resolves both regular and .onion domains
Tor DNS info in JSON format
Expected Output: {"ipv4": {"dns_url": "dns://...", "socks_url": "socks5://..."}}VPS SERVER INFORMATION
Display VPS server details and statistics
Show basic VPS information
Expected Output: Hostname: cluster-xxx, IPv4:Show detailed VPS stats
Expected Output: CPU Load, Memory Usage, Uptime, Network ConnectionsNote
Includes CPU load, memory, uptime, and connection stats
VPS info in JSON format
Expected Output: {"hostname": "...", "cpu_load": {...}, "memory": {...}}PROTOCOL LISTING
List available protocols with scores
List all available protocols
Expected Output: WireGuard (Score: 96.5), OpenVPN (Score: 94.0)...Protocol list in JSON
Expected Output: [{"name": "wireguard", "score": 96.5}]Show only available protocols
Expected Output: Available: WireGuard, Tor, ShadowsocksNote
Based on auth card
Sort by security score
Expected Output: 1. WireGuard (98.0), 2. OpenVPN (95.0)...Sort by speed score
Expected Output: 1. WireGuard (99.0), 2. Shadowsocks (85.0)...AUTO-SELECTION
Automatically select best protocol
Auto-select best protocol
Expected Output: Selected WireGuard (best overall score)Auto-select with minimum security
Expected Output: Selected OpenVPN (security: 95.0)Prioritize speed in selection
Expected Output: Selected WireGuard (fastest protocol)Auto-select with JSON output
Expected Output: {"selected": "wireguard", "reason": "best_score"}PORT USAGE
Local SOCKS5 port allocation for protocols
Shows port allocation for Shadowsocks
Expected Output: [PORT ALLOCATION] Port 30000 is AVAILABLE - selected for use Local SOCKS5 proxy will listen on: 127.0.0.1:30000Note
Shadowsocks uses ports 30000-30004
Shows port allocation for Xray VMess
Expected Output: [PORT ALLOCATION] Port 30010 is AVAILABLE Traffic flow: tun2socks → localhost:30010 → xray_client → remote_serverNote
Xray VMess uses ports 30010-30014
Shows port allocation for VLESS Reality
Expected Output: [PORT ALLOCATION] Port 30020 is AVAILABLE Local SOCKS5: 127.0.0.1:30020Note
VLESS Reality uses ports 30020-30024
Reference of all port ranges
Expected Output: Shadowsocks: 30000-30004 V2Ray: 30005-30009 Xray VMess: 30010-30014 Xray VLESS: 30015-30019 VLESS Reality: 30020-30024 Xray Trojan: 30025-30029 Mieru/Mita: 30030-30034 Tor: 30035-30039 Dante: 30040-30044 Hysteria2: 30045-30049Note
High ports avoid system conflicts
Check which local ports are in use
Expected Output: tcp LISTEN 0 128 127.0.0.1:30000 : users:(("ss-local",pid=12345,fd=3))Note
Shows process using each port
JSON OUTPUT FORMATS
Different JSON output options
Compact JSON output
Expected Output: {"status":"connected","protocol":"tor"}Pretty-printed JSON
Expected Output: { "status": "connected", "protocol": "tor" }Human-enhanced JSON
Expected Output: JSON with descriptions and metadataPretty JSON protocol list
Expected Output: Formatted JSON array of protocolsBENCHMARKING
Test protocol performance
Benchmark all protocols
Expected Output: WireGuard: 95Mbps, OpenVPN: 75Mbps...Note
Tests actual throughput
Benchmark specific protocol
Expected Output: WireGuard: Download: 95Mbps, Upload: 90MbpsExtended benchmark test
Expected Output: 60-second benchmark results...Benchmark results in JSON
Expected Output: {"wireguard": {"download": 95.5, "upload": 90.2}}TESTING PROTOCOLS
Test protocol connectivity without routing
Test Tor connectivity
Expected Output: Tor: SOCKS5 proxy responding at 127.0.0.1:9050Note
Doesn't change routing
Extended protocol test
Expected Output: Shadowsocks: Connected, Latency: 45ms, Throughput: OKTest all available protocols
Expected Output: Testing: Tor [OK], Shadowsocks [OK], V2Ray [FAIL]...Test with JSON output
Expected Output: {"protocol": "wireguard", "status": "ok", "latency": 12}NO-TUN MODE (MANUAL PROXY)
Run proxy without TUN interface for manual configuration
Start Shadowsocks SOCKS5 proxy without TUN
Expected Output: Shadowsocks SOCKS5 proxy ready at localhost:30000Note
Configure browser/app manually with localhost:30000
Connect to Dante SOCKS5 without routing traffic
Expected Output: Dante proxy: host:port, username, passwordNote
Direct connection to remote Dante server
Use Tor SOCKS5 proxy without system routing
Expected Output: Tor SOCKS5 proxy: 127.0.0.1:9050Note
Tor must be running. Apps connect to port 9050
V2Ray proxy in manual mode with JSON output
Expected Output: {"local_proxy_address":"127.0.0.1","local_proxy_port":30005}Note
V2Ray client runs, no system routing
Xray VLESS proxy for manual configuration
Expected Output: Xray SOCKS5 proxy ready at localhost:30015Firefox proxy settings example
Expected Output: Settings → Network → Manual proxy → SOCKS5: localhost, Port: 30000Note
Each protocol uses different port ranges
Chrome command line example
Expected Output: chrome --proxy-server="socks5://localhost:30000"Stop the proxy (works for both TUN and no-TUN modes)
Expected Output: Proxy stoppedCONFIGURATION EXPORT AND DISPLAY
Export and display protocol configurations
Export all configurations to default location
Expected Output: Exported 9 configuration(s) to ./results/configs/Note
Creates timestamped config files
Export specific protocol configuration
Expected Output: Exported 1 configuration(s) to ./results/configs/ - wireguard: wireguard_20250817_143022.confExport all configs to custom path
Expected Output: Exported 9 configuration(s) to /tmp/vpn-configs/Note
Creates directory if it doesn't exist
Export with credentials included
Expected Output: Exported 1 configuration(s) to ./results/configs/Note
⚠️ WARNING: Contains sensitive passwords
Export with JSON output showing results
Expected Output: {"exported_count": 9, "export_directory": "./results/configs/", "files": [...]}Display WireGuard configuration
Expected Output: Protocol Configurations:Note
Masks sensitive data by default
Show all protocol configs in pretty JSON
Expected Output: Formatted JSON with all available protocol configurationsShow config with passwords hidden
Expected Output: {"username": "dante_user", "password": "REDACTED"}Note
Safe for sharing/logging
Get Shadowsocks connection URL
Expected Output: ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTp6TDQ4cVYx...@Note
URL can be imported into mobile apps
Get SOCKS5 URLs in JSON format
Expected Output: {"ipv4": "socks5://user:pass@Get URLs for all available protocols
Expected Output: Protocol Connection URLs:shadowsocks: ipv4: ss://...
dante: ipv4: socks5://...
Generate QR code for WireGuard config
Expected Output: [QR Code ASCII Art]URL: wireguard://base64_encoded_config
Note
Scan with WireGuard mobile app
Generate IPv4 QR code for Shadowsocks (default)
Expected Output: [QR Code ASCII Art]URL: ss://...
Note
Shows IPv4 QR code by default for dual-stack protocols
Generate IPv6 QR code for Shadowsocks
Expected Output: [QR Code ASCII Art]URL: ss://...
Note
Use --ipv6 flag to show IPv6 QR for dual-stack protocols
Generate QR without validation (faster)
Expected Output: [QR Code ASCII Art]⚠ Validation skipped
Note
Skips automatic QR validation for debugging
Generate all QR codes with strict validation
Expected Output: ✓ Shadowsocks QR validated ✓ WireGuard QR validated...Note
Fails if any QR code validation fails
Get QR data in JSON format
Expected Output: {"dante": {"url": "socks5://...", "qr_available": true}}Note
JSON includes the URL for QR generation
Generate QR code and save as PNG file
Expected Output: [QR Code ASCII Art]✓ IPv4 QR code files saved to ./results/qr-codes/
Note
Saves clean PNG file: shadowsocks_ipv4.png
Generate IPv6 QR code and save as PNG file
Expected Output: [QR Code ASCII Art]✓ IPv6 QR code files saved to ./results/qr-codes/
Note
Saves clean PNG file: shadowsocks_ipv6.png
Generate both IPv4 and IPv6 QR codes
Expected Output: [QR Code ASCII Art]✓ IPv4 and IPv6 QR code files saved to ./results/qr-codes/
Note
Saves both shadowsocks_ipv4.png and shadowsocks_ipv6.png
Generate all QR codes with pretty JSON output
Expected Output: Pretty-formatted JSON with QR data and file pathsNote
Creates clean PNG files for all available protocols, supports all JSON formats
Save QR file with human-enhanced JSON output
Expected Output: {"qr_code": "base64data...", "saved_file_path": "./results/qr-codes/wireguard.png"}Note
VPN protocols use single filename (no IP version suffix)
QR CODE VALIDATION
Validate QR codes against auth card
Validate QR code from image file (NEW: direct filename)
Expected Output: ✓ QR valid: Shadowsocks (confidence: 98.5%)Note
Smart detection: automatically finds file in current dir or results/qr-codes/
Validate QR code from results/qr-codes directory
Expected Output: ✓ QR valid: Dante (confidence: 96.2%)Note
Automatically looks in ./results/qr-codes/ if not found in current directory
Validate QR code using explicit --file flag (legacy syntax)
Expected Output: ✓ QR valid: Shadowsocks (confidence: 98.5%)Note
Both direct filename and --file flag work identically
Validate QR URL from stdin
Expected Output: ✓ Protocol: shadowsocks ✓ Config matches auth cardNote
Useful for clipboard validation
Validate all generated QR codes
Expected Output: Validating all QR codes... ✓ shadowsocks_ipv4.png: valid ✓ wireguard.png: validNote
Checks all QR codes in results/qr-codes/
Test QR code readability
Expected Output: Testing QR readability... ✓ QR code is readableNote
Round-trip test of QR generation
JSON validation output
Expected Output: {"is_valid": true, "protocol": "shadowsocks", "confidence_score": 0.985}Note
Machine-readable validation results
ERROR RECOVERY
Recover from connection issues
Force disconnect stuck connection
Expected Output: Force killed all processes, routes restoredNote
Use when normal disconnect fails
Reset all routing to default
Expected Output: Routing reset to system defaultsNote
Emergency recovery command
Clean up orphaned processes
Expected Output: Cleaned up 2 orphaned tun2socks processesAutomatically diagnose and fix routing issues, restore network settings
Expected Output: System recovered, ready for new connectionNote
Performs comprehensive recovery including cleanup, route restoration, and DNS reset
Environment Variables
Variable | Description | Default | Values |
---|---|---|---|
RUST_LOG |
Set logging level (default: info) | info | error, warn, info, debug, trace |
Exit Codes
Code | Description |
---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | Permission denied |