add a unbounded endpoint that integrates unbounded into sing-box#22
Draft
add a unbounded endpoint that integrates unbounded into sing-box#22
Conversation
The unbounded endpoint can be configured (role) to run as an inbound (peer), and outbound (client), or as both at the same time. When running as inbound, it builds a WebRTC peer connection with another unbounded endpoint running as client role, receiving TCP/UDP requests over QUIC and routes to singbox. When running as outbound, it builds a WebRTC peer connection with another unbounded endpoint running as peer role, receiving TCP/UDP requests from singbox and hands over through the unbouned QUIC layer to the peer. For TCP it uses QUIC streams and for UDP it uses QUIC datagram.
UDP packet chunking Heartbeat from QUIC datagram from both client/server
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR integrates the Unbounded transport into sing-box as a new “unbounded” endpoint, enabling it to operate in client, peer, or dual roles over QUIC and WebRTC.
- Adds
UDPOverQUICHandlerto multiplex UDP traffic over QUIC datagrams, with session management and keep-alive. - Implements
Endpointinendpoint.goto configure and run Unbounded as outbound (client), inbound (peer), or both. - Registers the new protocol, updates options, constants, and dependencies (go.mod).
Reviewed Changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| protocol/unbounded/udp.go | Implements UDP-over-QUIC handling, sessions, and routing |
| protocol/unbounded/endpoint.go | Defines the Unbounded Endpoint adapter with client/peer logic |
| protocol/unbounded/doc.go | Adds basic package documentation |
| protocol/register.go | Registers Unbounded endpoint in the registry |
| option/unbounded.go | Defines configuration options for the Unbounded endpoint |
| go.mod | Bumps Go version and adds Unbounded-related dependencies |
| constant/proxy.go | Adds the TypeUnbounded constant |
Comments suppressed due to low confidence (2)
option/unbounded.go:6
- The
WebRTCTagoption is never used inEndpoint; the code generates its own UUID tags instead. If you intend to allow users to set this, wire it throughcreateClientOptionsandcreatePeerOptions, or remove the unused field.
WebRTCTag string `json:"webrtc_tag"` // might need to separate this tag for inbound (peer) and outbound (client)
protocol/unbounded/endpoint.go:205
- The
Rolefield accepts any string at runtime but only supportsclient,peer, orboth. Add explicit validation and return an error for unsupported values to fail fast on misconfiguration.
switch options.Role {
This points to unmerged PRs: quicwrapper: jovis/2035-support-singbox-pr unbounded: jovis/2035-support-singbox-pr And this one updates to latest main: telemetry: current main Also use github.com/sagernet/sing instead of lantern's because of building with these tags will fail: ❯ go build -tags with_utls,with_quic .../global/pkg/mod/github.com/getlantern/sing-box-minimal@v1.11.12-0.20250616155750-74188abad925/route/route.go:527:39: undefined: M.IsDomainName .../global/pkg/mod/github.com/getlantern/sing-box-minimal@v1.11.12-0.20250616155750-74188abad925/route/route.go:625:41: undefined: M.IsDomainName
dafad42 to
b60638d
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.
This PR adds unbounded to sing-box as an
endpoint, that can be configured to run as 3 different roles:See more details in the ticket #2035 about implementation details and decisions.
This is part of #2035 and depends on other 2 PRs to be merged first.