Wire BanditURLOverrides through to MutableURLTest#333
Conversation
Pass per-proxy callback URLs from config response through to sing-box MutableURLTest URLOverrides, enabling per-ISP bandit proxy assignment on the client side. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR threads BanditURLOverrides from the loaded config through to Lantern’s MutableURLTestOutboundOptions.URLOverrides, enabling per-proxy URL test callback overrides to reach the sing-box mutable URL test implementation.
Changes:
- Extend
urlTestOutbound()andappendGroupOutbounds()to accepturlOverrides map[string]stringand forward it intoMutableURLTestOutboundOptions.URLOverrides. - Pass
cfg.BanditURLOverridesinto the Lantern server group’s URL test outbound; keep User/All URL test outbounds usingnil. - Update module dependencies (
go.mod/go.sum) to versions/branches that include the new options surface.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vpn/vpn.go | Updates pre-start URL test outbound construction to the new urlTestOutbound signature (currently passing nil overrides). |
| vpn/tunnel_test.go | Updates tests to call urlTestOutbound with the new signature. |
| vpn/boxoptions.go | Wires BanditURLOverrides into the Lantern group’s MutableURLTest outbound and adds URLOverrides to the outbound options. |
| go.mod | Bumps common/lantern-box (and other deps) to versions needed for the new override option surface. |
| go.sum | Corresponding checksum updates after dependency changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Forward cfg.BanditURLOverrides into the preTest urlTestOutbound so bandit callback URLs are used during pre-start URL testing, not just during normal operation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that URLOverrides from config.BanditURLOverrides are correctly forwarded into the auto-lantern MutableURLTestOutboundOptions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Periodically reports per-outbound throughput to the bandit system so it can optimize for actual download speed, not just connectivity. Interval and body size are randomized to avoid creating a fingerprintable signal. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sts" This reverts commit 7b3bd80.
|
@myleshorton are the |
Basically each config response is a test for each "arm" of the multi-armed bandit, so each URL has a token for that test that allows the server to identify it when the client makes the callback. So each proxy gets its own token essentially. |
|
Gotcha. Then they'll become invalid as soon as we receive a new config... We could add a field, ( |
|
I don't quite understand the problem sorry. What's bad about them becoming invalid? |
|
When a new config is received, won't it have new override URLs that are specific to the new proxies? |
|
Yeah, but that's what we want -- that means the server wants to test those. |
Right, so when we get a new config while the VPN is connected, we update the outbounds/endpoints and just add the new tags to the |
|
Oh sorry I misunderstood! OK, I should be able to fix that. |
Persist URLOverrides in servers.Options so they survive file-watcher reloads, and call SetURLOverrides in updateGroup so new proxies from a config refresh get their bandit callback URLs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
OK that last commit implements a fairly straightforward solution I think? |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix URLOverrides lost through removeDuplicates: stash overrides before dedup and pass the stashed value to SetURLOverrides - Persist URLOverrides through servers.Manager: clone in setServers and Servers so overrides survive save/load round-trips - go.sum updated by go mod tidy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The merge() function rebuilds Options without carrying URLOverrides, so AddServers would silently drop them. Merge incoming URLOverrides into the existing group's map alongside Locations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts: # go.mod # go.sum # vpn/tunnel.go
Update lantern-box to v0.0.6-0.20260304185010-31f62b643c0e (latest) and resolve go.mod/go.sum merge conflicts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Resolves conflicts in: - servers/manager.go: keep both URLOverrides (bandit) and Credentials (main) fields - go.mod/go.sum: take main's kindling and lantern-box versions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- boxoptions.go: Reduce URL test interval from 3min to 15s so bandit callbacks arrive within the 20s probe expiry window. Reduce idle timeout from 15min to 5min. - tunnel.go: Log when bandit URL overrides are applied to a URL test group, including the override count. - config.go: Log when config response includes bandit URL overrides with counts for overrides, outbounds, and endpoints. The 3-minute interval was the root cause of high failure rates — probes expire in 20s but the client wouldn't test until 3 minutes later, so the reaper always recorded reward=0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… interval Instead of lowering the URL test interval globally (which increases traffic for all users), trigger CheckOutbounds() immediately when a new config with bandit URL overrides arrives from the API. This fires the callbacks within seconds of probe creation. - tunnel.go: After SetURLOverrides, call CheckOutbounds to fire an immediate URL test cycle. Log override application and trigger. - config.go: Log when config response includes bandit URL overrides. - go.mod: Update lantern-box to include OutboundChecker interface. The URL test interval stays at 3 minutes for normal operation. Callbacks only need to be fast on initial config receipt. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- tunnel.go: Carry URLOverrides and Credentials through removeDuplicates so bandit overrides aren't silently dropped (fixes review comment) - tunnel.go: Only trigger CheckOutbounds after SetURLOverrides succeeds to avoid testing against default URLs on failure - fetcher.go: Guard RADIANCE_FEATURE_OVERRIDE with non-empty check to avoid sending an empty X-Lantern-Feature-Override header - README.md: Clarify that feature override works in any environment, not just non-prod Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
BanditURLOverridesfrom config response through to sing-boxMutableURLTestOutboundOptions.URLOverridesurlTestOutbound()andappendGroupOutbounds()to accept and forwardurlOverrides map[string]stringnilcommonandlantern-boxbandit-url-overrides branchesTest plan
go vet ./vpn/...passesTestConnectionandTestUpdateServersstill pass🤖 Generated with Claude Code