Back
46/65
Lesson 46
5 min
Rust Proxy: Targeted Routing
Route selected domains through an upstream proxy, machine-wide
Ready to level up?
Mark complete to track your learning progress.
Route selected domains through an upstream proxy, machine-wide
Mark complete to track your learning progress.
Route only selected domains through an upstream HTTP proxy, machine-wide, without a global system proxy.
Rust Proxy is a targeted, machine-wide transparent proxy for Linux. iptables + ipset redirect only the domains you list into a local daemon, which tunnels them through your chosen upstream HTTP proxy.
Everything else stays direct, and no app needs proxy settings. It routes traffic; it does not inspect or decrypt it.
No app changes needed
Tunnels TLS via CONNECT, no MITM
Minimal overhead in Rust
Bytes, ping, health, failover
init writes a config that already targets the main AI and cloud provider domains (Anthropic, OpenAI, Google, AWS, Cloudflare, Vercel, Supabase). Register an upstream proxy, add any other domains, then start the routing daemon.
# Create ~/.config/rust_proxy/config.toml (with default targets)rust_proxy init# Register an upstream HTTP proxyrust_proxy proxy add mesh-us us-wa.proxymesh.com:31280 \--username-env PROXY_USER --password-env PROXY_PASS# Add a domain that is not in the defaultsrust_proxy targets add api.x.ai# Activate, then run the daemon (iptables + ipset need root)rust_proxy activate --selectsudo rust_proxy daemon# Verifyrust_proxy status
HTTPS_PROXY needed: the daemon redirects only traffic bound for your target domains, machine-wide. By default the ipset also includes the published AWS, Cloudflare and Google IPv4 ranges; set the include_*_ip_ranges settings to false to turn that off. Linux and IPv4 only.Check how a destination will be routed and whether the upstream proxy is healthy.
# Would this destination be proxied?rust_proxy test https://api.anthropic.com --verbose# Trace the CONNECT flowrust_proxy trace api.anthropic.com --tls# Upstream latencyrust_proxy ping --count 5# Health checkrust_proxy doctor
daemon, deactivate and cleanup-stale need sudo. Run sudo rust_proxy deactivate to restore direct routing.api.anthropic.com is a target, so iptables redirects it to the daemon, which tunnels it through the upstream proxy with CONNECT. TLS passes through untouched.
Encrypted TLS records, copied byte-for-byte in both directions. rust_proxy never terminates TLS, so request and response bodies (and the client's API key) are never visible to it.
RANO shows which process talks to which provider; RP decides which of those connections leave through the upstream proxy
Every agent pane gets the same routing, with no per-pane proxy env vars
CAAM switches accounts; RP only picks the network path and never sees API keys
Track network issues as beads