Add direct transport context for unbounded signaling#200
Merged
myleshorton merged 2 commits intonelson/unbounded-integrationfrom Mar 25, 2026
Merged
Add direct transport context for unbounded signaling#200myleshorton merged 2 commits intonelson/unbounded-integrationfrom
myleshorton merged 2 commits intonelson/unbounded-integrationfrom
Conversation
Introduce adapter.ContextWithDirectTransport / DirectTransportFromContext so that the host application (radiance) can inject an http.RoundTripper whose DialContext is wired through sing-box's direct outbound. This ensures unbounded's WebRTC signaling HTTP requests bypass the VPN tunnel on all platforms via the existing socket protection mechanisms (VpnService.protect on Android, IP_BOUND_IF on iOS/macOS, etc.). The unbounded outbound now checks for this direct transport at construction time and falls back to the outbound dialer when none is registered (preserving existing behavior in tests and standalone usage). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a context-based injection point for a “direct” http.RoundTripper so Unbounded’s WebRTC signaling HTTP requests can bypass the VPN tunnel when radiance registers a kindling-backed transport, while preserving existing fallback behavior.
Changes:
- Introduce
adapter.ContextWithDirectTransport/adapter.DirectTransportFromContextfor wiring a bypass transport viacontext.Context. - Update Unbounded outbound initialization to prefer the injected direct transport for signaling HTTP, falling back to the outbound dialer-backed transport.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
protocol/unbounded/outbound.go |
Uses an injected direct http.RoundTripper for signaling when present; otherwise retains the existing dialer-based transport. |
adapter/direct_transport.go |
Adds context helpers to register/retrieve a direct http.RoundTripper for tunnel-bypass HTTP flows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
myleshorton
added a commit
to getlantern/radiance
that referenced
this pull request
Mar 24, 2026
Add lazyDirectTransport, an http.RoundTripper that wraps sing-box's direct outbound dialer. It is registered in the context before the sing-box service is created (so unbounded can retrieve it during construction) and resolved after (once the direct outbound exists). The direct outbound's dialer carries platform-specific socket protection (VpnService.protect on Android, IP_BOUND_IF on iOS/macOS, etc.), ensuring that unbounded's signaling traffic bypasses the VPN tunnel on all platforms. Depends on getlantern/lantern-box#200 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
DialContext is sufficient; the Dial field was deprecated and captured the outer context which is misleading. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Bringing this in, as it's needed and harmless. |
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.
Summary
adapter.ContextWithDirectTransport/DirectTransportFromContextfor injecting anhttp.RoundTripperthat bypasses the VPN tunnelMotivation
Unbounded needs kindling (censorship-evasion smart transport) for its signaling HTTP requests. Kindling lives in radiance, not lantern-box. This PR provides the context-based injection point so radiance can wire kindling's transport (backed by sing-box's direct outbound with proper socket protection) into unbounded without creating a circular dependency.
Radiance side: After tunnel
Start(), radiance will retrieve thedirectoutbound, build a kindling-poweredhttp.RoundTripperusing itsDialContext, and register it viaadapter.ContextWithDirectTransport(ctx, rt)before the service is created.How it bypasses the tunnel on each platform:
VpnService.protect(fd)viaPlatformInterface.AutoDetectInterfaceControlIP_BOUND_IF/IPV6_BOUND_IFsocket optionSO_BINDTOIFINDEXsocket optionTest plan
DirectTransportFromContextreturns nil when nothing registered🤖 Generated with Claude Code