Skip to content

Commit

Permalink
webrtc: remove experimental tag, enable by default (#2887)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored Jul 31, 2024
1 parent f80d18f commit cb81b3e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 4 additions & 0 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
libp2pwebrtc "github.com/libp2p/go-libp2p/p2p/transport/webrtc"
ws "github.com/libp2p/go-libp2p/p2p/transport/websocket"
webtransport "github.com/libp2p/go-libp2p/p2p/transport/webtransport"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -47,6 +48,7 @@ var DefaultTransports = ChainOptions(
Transport(quic.NewTransport),
Transport(ws.New),
Transport(webtransport.New),
Transport(libp2pwebrtc.New),
)

// DefaultPrivateTransports are the default libp2p transports when a PSK is supplied.
Expand Down Expand Up @@ -82,9 +84,11 @@ var DefaultListenAddrs = func(cfg *Config) error {
"/ip4/0.0.0.0/tcp/0",
"/ip4/0.0.0.0/udp/0/quic-v1",
"/ip4/0.0.0.0/udp/0/quic-v1/webtransport",
"/ip4/0.0.0.0/udp/0/webrtc-direct",
"/ip6/::/tcp/0",
"/ip6/::/udp/0/quic-v1",
"/ip6/::/udp/0/quic-v1/webtransport",
"/ip6/::/udp/0/webrtc-direct",
}
listenAddrs := make([]multiaddr.Multiaddr, 0, len(addrs))
for _, s := range addrs {
Expand Down
2 changes: 2 additions & 0 deletions libp2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func TestInsecure(t *testing.T) {
func TestDefaultListenAddrs(t *testing.T) {
reTCP := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/tcp/")
reQUIC := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/udp/([0-9]*)/quic-v1")
reWebRTC := regexp.MustCompile("/(ip)[4|6]/((0.0.0.0)|(::))/udp/([0-9]*)/webrtc-direct/certhash/(.*)")
reCircuit := regexp.MustCompile("/p2p-circuit")

// Test 1: Setting the correct listen addresses if userDefined.Transport == nil && userDefined.ListenAddrs == nil
Expand All @@ -100,6 +101,7 @@ func TestDefaultListenAddrs(t *testing.T) {
for _, addr := range h.Network().ListenAddresses() {
if reTCP.FindStringSubmatchIndex(addr.String()) == nil &&
reQUIC.FindStringSubmatchIndex(addr.String()) == nil &&
reWebRTC.FindStringSubmatchIndex(addr.String()) == nil &&
reCircuit.FindStringSubmatchIndex(addr.String()) == nil {
t.Error("expected ip4 or ip6 or relay interface")
}
Expand Down
10 changes: 0 additions & 10 deletions p2p/transport/webrtc/transport.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
// Package libp2pwebrtc implements the WebRTC transport for go-libp2p,
// as described in https://github.com/libp2p/specs/tree/master/webrtc.
//
// At this point, this package is EXPERIMENTAL, and the WebRTC transport is not enabled by default.
// While we're fairly confident that the implementation correctly implements the specification,
// we're not making any guarantees regarding its security (especially regarding resource exhaustion attacks).
// Fixes, even for security-related issues, will be conducted in the open.
//
// Experimentation is encouraged. Please open an issue if you encounter any problems with this transport.
//
// The udpmux subpackage contains the logic for multiplexing multiple WebRTC (ICE)
// connections over a single UDP socket.
package libp2pwebrtc

import (
Expand Down
2 changes: 2 additions & 0 deletions p2p/transport/webrtc/udpmux/mux.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// The udpmux package contains the logic for multiplexing multiple WebRTC (ICE)
// connections over a single UDP socket.
package udpmux

import (
Expand Down

0 comments on commit cb81b3e

Please sign in to comment.