Repository navigation
wgengine,feature: add optional webrtc path to magicsock - #21030
Draft
adrianosela wants to merge 1 commit into
Draft
adrianosela wants to merge 1 commit into
adrianosela wants to merge 1 commit into
Conversation
adrianosela
force-pushed
the
adrianosela/21027-magicsock-webrtc-path-reference
branch
12 times, most recently
from
September 3, 2026 14:31
c987afa to
e139bab
Compare
mat2uken
pushed a commit
to mat2uken/tailcatsend
that referenced
this pull request
Sep 8, 2026
- Apply WebRTC transport patch based on tailscale/tailscale#21030 - Register feature/webrtc in web wasm bridge, daemon, and native bridge - Add redundant STUN servers and support custom TURN configuration - Cache and maintain WebRTC data channels across transfer streams in Web bridge - Add Web-to-Web WebRTC P2P verification test
adrianosela
force-pushed
the
adrianosela/21027-magicsock-webrtc-path-reference
branch
4 times, most recently
from
September 10, 2026 17:50
0eca411 to
f548903
Compare
adrianosela
force-pushed
the
adrianosela/21027-magicsock-webrtc-path-reference
branch
from
September 15, 2026 17:20
f548903 to
e17a804
Compare
adrianosela
force-pushed
the
adrianosela/21027-magicsock-webrtc-path-reference
branch
2 times, most recently
from
September 25, 2026 18:18
398d719 to
35a6fab
Compare
Add an optional WebRTC connectivity path to magicsock, primarily so browser (js/wasm) nodes, which cannot open raw UDP sockets, can reach peers directly instead of always relaying through DERP. The implementation lives in a new feature/webrtc package that plugs into magicsock through a hook, so magicsock itself keeps no dependency on pion/WebRTC. The feature is opt-in: it is linked in only when a program blank-imports feature/webrtc, and its init registers the manager via magicsock.HookNewWebRTCManager. When it is not linked, the hook stays unset and the WebRTC path is absent. Signaling reuses the existing disco/DERP path rather than a standalone server: offers, answers, and ICE candidates travel as a single new TypeWebRTCSignal disco message, so no external signaling server is needed. Once a data channel is up it appears to the rest of magicsock as a peer path at the WebRTCMagicIP (127.3.3.41) address, ranked above DERP but below direct UDP. WebRTC is only attempted when at least one side is a js node, so native-to-native peers are unaffected. TS_DEBUG_NEVER_DIRECT_WEBRTC disables the path at runtime for debugging, falling back to DERP. Updates #21027 Signed-off-by: Adriano Sela Aviles <[email protected]>
adrianosela
force-pushed
the
adrianosela/21027-magicsock-webrtc-path-reference
branch
from
October 20, 2026 17:24
35a6fab to
98f7c42
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.
Add an optional WebRTC connectivity path to magicsock, primarily so
browser (js/wasm) nodes, which cannot open raw UDP sockets, can reach
peers directly instead of always relaying through DERP.
The implementation lives in a new feature/webrtc package that plugs into
magicsock through a hook, so magicsock itself keeps no dependency on
pion/WebRTC. The feature is opt-in: it is linked in only when a program
blank-imports feature/webrtc, and its init registers the manager via
magicsock.HookNewWebRTCManager. When it is not linked, the hook stays
unset and the WebRTC path is absent.
Signaling reuses the existing disco/DERP path rather than a standalone
server: offers, answers, and ICE candidates travel as a single new
TypeWebRTCSignal disco message, so no external signaling server is
needed. Once a data channel is up it appears to the rest of magicsock as
a peer path at the WebRTCMagicIP (127.3.3.41) address, ranked above DERP
but below direct UDP. WebRTC is only attempted when at least one side is
a js node, so native-to-native peers are unaffected.
TS_DEBUG_NEVER_DIRECT_WEBRTC disables the path at runtime for debugging,
falling back to DERP.
Updates #21027