Skip to content

Proxy UDP fallback for hostname ACL routes#3252

Open
TurboTheTurtle wants to merge 2 commits into
shadowsocks:masterfrom
TurboTheTurtle:fix-udp-fallback-acl
Open

Proxy UDP fallback for hostname ACL routes#3252
TurboTheTurtle wants to merge 2 commits into
shadowsocks:masterfrom
TurboTheTurtle:fix-udp-fallback-acl

Conversation

@TurboTheTurtle

Copy link
Copy Markdown

Summary:

  • Route UDP fallback with all for gfwlist/custom-rules profiles.
  • Keep the existing route behavior for subnet/IP-based routes.

Why:
UDP relay decisions are made against IP endpoints. Hostname-heavy ACLs such as gfwlist and custom-rules can therefore bypass the selected UDP fallback even when the user configured one, which prevents QUIC/HTTP3 traffic from reaching the fallback server.

Closes #3070.

Validation:

  • git diff --check
  • JAVA_HOME=/opt/homebrew/opt/openjdk@21 ANDROID_HOME=/Users/andy/Library/Android/sdk ./gradlew :core:compileDebugKotlin

Please preserve author attribution if this PR is squashed or reworked:
Co-authored-by: Andy Ye 35905412+TurboTheTurtle@users.noreply.github.com

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes UDP fallback routing for hostname-driven ACL modes (notably gfwlist and custom-rules) by ensuring UDP fallback decisions are not accidentally bypassed due to UDP being evaluated against IP endpoints rather than hostnames.

Changes:

  • Construct the UDP fallback ProxyInstance with route all when the main profile route is gfwlist or custom-rules.
  • Preserve existing UDP fallback routing behavior for other route modes by continuing to pass through profile.route.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

data.proxy = ProxyInstance(profile)
data.udpFallback = if (fallback == null) null else ProxyInstance(fallback, profile.route)
data.udpFallback = if (fallback == null) null else ProxyInstance(fallback, when (profile.route) {
// UDP relay sees IP endpoints, so hostname-only ACL routes would bypass the selected fallback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UDP fallback doesn't work with gfwlist or custom rules

2 participants