Skip to content

Commit c162d21

Browse files
committed
set private transport to an empty array by default for JS
1 parent b436663 commit c162d21

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

defaults.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,8 @@ var DefaultTransports = ChainOptions(
1818
Transport(webtransport.New),
1919
Transport(libp2pwebrtc.New),
2020
)
21+
22+
var DefaultPrivateTransports = ChainOptions(
23+
Transport(tcp.NewTCPTransport),
24+
Transport(ws.New),
25+
)

defaults_js.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ package libp2p
55

66
// Only WebSocket and WebTransport are supported in the browser.
77
var DefaultTransports = ChainOptions()
8+
var DefaultPrivateTransports = ChainOptions()

defaults_shared.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
"github.com/libp2p/go-libp2p/p2p/net/swarm"
1414
"github.com/libp2p/go-libp2p/p2p/security/noise"
1515
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
16-
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
17-
ws "github.com/libp2p/go-libp2p/p2p/transport/websocket"
1816
"github.com/prometheus/client_golang/prometheus"
1917

2018
"github.com/multiformats/go-multiaddr"
@@ -44,10 +42,6 @@ var DefaultMuxers = Muxer(yamux.ID, yamux.DefaultTransport)
4442
//
4543
// Use this option when you want to *extend* the set of transports used by
4644
// libp2p instead of replacing them.
47-
var DefaultPrivateTransports = ChainOptions(
48-
Transport(tcp.NewTCPTransport),
49-
Transport(ws.New),
50-
)
5145

5246
// DefaultPeerstore configures libp2p to use the default peerstore.
5347
var DefaultPeerstore Option = func(cfg *Config) error {

0 commit comments

Comments
 (0)