mirror of
https://github.com/libp2p/go-libp2p.git
synced 2026-04-22 16:17:19 +08:00
webrtc: remove experimental tag, enable by default (#2887)
This commit is contained in:
@@ -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"
|
||||
@@ -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.
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// The udpmux package contains the logic for multiplexing multiple WebRTC (ICE)
|
||||
// connections over a single UDP socket.
|
||||
package udpmux
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user