Repository navigation
System proxy + TUN: connections to the local proxy port are matched by rules and sent to a remote node → EOF #875
AndrewGoal
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Environment
Symptom
With «系统代理 (System proxy)» enabled, every app that honours the proxy fails. Example: SmartTube (Retrofit + OkHttp) fails on all requests, including the home feed:
Apps that ignore the Android system proxy (e.g. YouTube TV, which uses Cronet) work fine. DNS/network is otherwise healthy — no proxy is set anywhere else (
settings get global http_proxyis null).Clash log (repeats on every client retry)
127.19.22.59:33233is the local listener created byTunModule.listenHttp()(127.x.y.z:0, random per start — I also observed127.152.199.170:41333). The client's connection to the proxy's own port is being taken as outbound traffic, matched by the finalMATCHrule and sent to a remote node; the remote node can't dial127.19.22.59, so the client gets EOF.Things that should have prevented this but didn't
127.0.0.0/8is not routed into the VPN (it's inarrays.xml→bypass_private_route), verified withip route.IP-CIDR,127.0.0.0/8,🎯 全球直连,no-resolvenear the top ofrules:, yet the connection still matched the trailingMATCHrule — so the connection metadata seems to have no usable DstIP at match time.tun:section at all (CMFA builds the interface itself, as expected).Workaround
Turning «系统代理» off fixes it immediately and permanently (with TUN auto-route the proxy is redundant anyway). Everything works again, including the same apps.
Question
Is this the expected behaviour of system proxy + TUN on Android? If it's a known limitation, maybe the switch should be disabled when TUN/auto-route is on, or the proxy's listen port should be excluded from tun matching. I'm happy to run further tests (e.g. gVisor / mixed stack) if that helps pinpoint it.
Related: #852 (same class of problem — a socket owned by the app looping into its own tun).
All reactions