Repository navigation
feat: add opt-in target-scoped TCP fallback - #3397
Open
abcjhby2871 wants to merge 1 commit into
Open
abcjhby2871 wants to merge 1 commit into
abcjhby2871 wants to merge 1 commit into
Conversation
abcjhby2871
marked this pull request as ready for review
November 2, 2026 16:32
abcjhby2871
force-pushed
the
feat/target-scoped-tcp-fallback
branch
from
November 2, 2026 16:35
2cd2ef8 to
1d02dd1
Compare
abcjhby2871
force-pushed
the
feat/target-scoped-tcp-fallback
branch
from
November 2, 2026 16:36
1d02dd1 to
28e901e
Compare
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.
Related to #1433 and clash-verge-rev/clash-verge-rev#8518.
A DIRECT rule can select a destination that fails to establish while a chosen parent can reach it. Fixed-URL fallback health does not express this per-target decision. This draft adds an explicit
target-fallbackgroup; existing rule/group behavior remains unchanged unless traffic is deliberately routed to it.The group bounds each connection to one DIRECT route attempt and one selected parent attempt, shares concurrent route decisions, caches successful preferences, and cools down dual failures. Caller cancellation is not cached. Network/parent changes invalidate decisions without reloading rules or closing streams. A terminal error prevents outer tunnel retries from multiplying the budget. The controller exposes aggregate cache statistics and a flush operation.
This is a limited TCP prototype: HTTP/SOCKS5 parents must acknowledge the actual target CONNECT, use literal endpoint IPs, and avoid nested dialers/multiplexing. SOCKS5 confirmed dialing validates reply status through a separate entry point while retaining legacy behavior and lifecycle references. Implicit loopback gateways are rejected. Shadowsocks parents, UDP/QUIC fallback, and replay after TLS/application failure are not implemented. The group does not equate reaching a proxy node with reaching the destination.
Validation:
Alphaat69c16319b12d10ec1ed05eefca3a482357f5ffbb.SKIP_INTEROP_TEST=1 go test ./... -count=1and the same command with-tags with_gvisorboth passed.-race, repeated five times on the Alpha baseline, including 128 concurrent dual failures and 64 cached-parent recovery calls.Only synthetic test destinations are included. Operational logs, packet captures, local configuration, credentials, and real-site test details are excluded. This draft requests review of the API/protocol boundaries and is not presented as production-qualified for arbitrary parent protocols.
Assisted by OpenAI Codex.