feat(mux): add 'drop' option for xudpProxyUDP443 to prevent IP leak in TUN mode#6460
Closed
TGIR0 wants to merge 1 commit into
Closed
feat(mux): add 'drop' option for xudpProxyUDP443 to prevent IP leak in TUN mode#6460TGIR0 wants to merge 1 commit into
TGIR0 wants to merge 1 commit into
Conversation
Member
|
哎 又是AI pr乱猜 core里关闭当前udp conn在tun表现为删除该映射 没有你说的 "connection rejection or ICMP port unreachable" 甚至连 “automatic fallback” 都不知道存不存在 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a new
"drop"option toxudpProxyUDP443in the Mux configuration to silently consume UDP 443 (QUIC) packets instead of abruptly rejecting them.Why is this needed? (The Bug)
Currently, when
xudpProxyUDP443is set to"reject", the outbound handler abruptly returns an error and interrupts the reader/writer.In VPN / TUN environments (e.g. Windows/Android TUN mode clients), when the OS network stack receives a sudden connection rejection or ICMP port unreachable for UDP, it assumes the TUN interface is broken for that destination. The OS then performs an automatic fallback to the physical network interface (e.g., Wi-Fi / Cellular).
This OS-level behavior bypasses the proxy entirely, causing the user's real IP address (e.g. in Iran or China) to be leaked for blocked QUIC traffic.
How does this fix it?
By setting
"xudpProxyUDP443": "drop", the UDP traffic is silently consumed and discarded (similar to theblackholeproxy mechanism) usingbuf.Discardwith an inactivity timeout.Because the connection is dropped silently rather than rejected, the OS does not trigger a network fallback. Instead, the browser's QUIC connection simply times out, forcing it to gracefully fall back to TCP 443 (HTTPS), which is then safely routed through the proxy tunnel without any IP leaks.
Changes:
infra/conf/xray.go: Added"drop"to the valid switch cases forxudpProxyUDP443.app/proxyman/outbound/handler.go: Added the"drop"case which copies thelink.Readertobuf.Discardusingsignal.CancelAfterInactivityto prevent goroutine leaks.