Repository navigation
Conversation
tobwen
force-pushed
the
feat/cascade-weight-434
branch
4 times, most recently
from
November 8, 2026 20:00
ae19810 to
d414ea6
Compare
The dialer left the upstream connection open after a write failure, an unreadable status line, or a rejected status, and ignored malformed response headers after 200 OK. Return header parsing errors and close the buffered connection on every failed handshake; successful tunnels keep buffered payload bytes.
pr/prs select by relative weight and dial complete chains per level. Budgets are request-local: retries/retrydelay per forwarder, attempts/attemptdelay per cascade via -cascade; precedence is level > global > forwarder. Weight-0 levels stay absent; pr falls back to direct, prs never does. Health checks alone disable hops; dial errors count once and diagnostics never echo URLs. Also closes Trojan and UDP dial failures cleanly and removes the double failure count in proxy servers.
In-process fake dialers and real protocol servers cover complete-chain dialing, per-level budgets, override precedence, UDP restrictions, pr/prs fallback, rule routing and the health checkers. Package coverage 73 percent, stable under repeated runs.
tobwen
force-pushed
the
feat/cascade-weight-434
branch
from
November 8, 2026 20:06
d414ea6 to
172aa10
Compare
tobwen
marked this pull request as ready for review
November 8, 2026 20:17
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.
Closes #434
Summary
This adds weighted proxy chaining: main forwarders tagged with
#cascade=Nform ordered levels, and each request dials one weighted-random pick per level instead of a single forwarder. Budgets have two parts: per forwarder (#retries,#retrydelay) and global/per-level through the-cascadeflag, which also carries the chain-level budget (attempts,attemptdelay).pr/prsselect main forwarders by relative weight (#weight=N) and dial complete cascade chains grouped by#cascade=Nlevels, in numeric order, 3proxy-style weighted parent groups.retries/retrydelayrepeat the selected forwarder,attempts/attemptdelaytrigger new weighted draws. Both are configured through-cascade '[cascade=N&]retries=N&retrydelay=MS&attempts=N&attemptdelay=MS'with per-field precedence: specific cascade > global > forwarder, independent of order.prskips unavailable levels and falls back to direct after all chain attempts fail;prsrequires every active level and never falls back to direct. Weight-0 forwarders never participate in pr/prs. Health checks alone disable cascade hops; dial failures and relay errors never do.check=disableenables everything immediately); cascades advance independently, the longest required pause applies, and there is no overall time limit.Tests
config/examples/10.cascade_with_weight/glider.confis a runnable example; the README feature section documents every switch in user terms.In-process fake dialer schemes and real protocol servers cover complete-chain dialing, per-level budgets, redraw weights, override precedence, UDP restrictions and
pr/prsfallback (rule/*_test.go).Validation (Go 1.27, linux/amd64 and linux/386):
go test ./... -count=1,go test -race ./rule,GOARCH=386 CGO_ENABLED=0 go test ./rule,go test ./rule -run TestCascade -count=20,go vet ./...,gofmt -l ..