netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.74k stars 483 forks source link

Add option to force P2P connection via WebRTC #2137

Open thinadusk opened 3 months ago

thinadusk commented 3 months ago

In https://docs.netbird.io/about-netbird/how-netbird-works, it shows P2P traffic tunneling directly through WireGuard. If I understand correctly, this is raw, unencapsulated WireGuard traffic.

In some networks, WireGuard traffic may be restricted, and since Netbird already supports WebRTC for relaying, it would be helpful to add an option to use it for P2P connections.

This can be accomplished in a number of ways:

Related: #1096

braginini commented 3 months ago

hey @thinadusk Your understanding is correct - the traffic is raw WireGuard traffic. The change that you are proposing is not as easy as it sounds and requires the whole transport logic refactor. NetBird uses ICE from WebRTC to negotiate direct connections. However, it doesn't use data channels of WebRTC. We had some thoughts around it but we lack a real strong use case that would benefit most of the users.

Bottom line, I don't think that we will persue this in the near future. However, we are working on relay improvements that might help with these issues.

What is your environment that blocks WireGuard?