Skip to content

Commit 6f3a53c

Browse files
committed
disable compilation for tls for wasm
1 parent 4b161b3 commit 6f3a53c

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

defaults.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
package libp2p
55

66
import (
7+
"github.com/libp2p/go-libp2p/p2p/security/noise"
8+
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
79
quic "github.com/libp2p/go-libp2p/p2p/transport/quic"
810
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
911
libp2pwebrtc "github.com/libp2p/go-libp2p/p2p/transport/webrtc"
@@ -23,3 +25,8 @@ var DefaultPrivateTransports = ChainOptions(
2325
Transport(tcp.NewTCPTransport),
2426
Transport(ws.New),
2527
)
28+
29+
var DefaultSecurity = ChainOptions(
30+
Security(tls.ID, tls.New),
31+
Security(noise.ID, noise.New),
32+
)

defaults_js.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
package libp2p
55

6+
import "github.com/libp2p/go-libp2p/p2p/security/noise"
7+
68
// Only WebSocket and WebTransport are supported in the browser.
79
var DefaultTransports = ChainOptions()
810
var DefaultPrivateTransports = ChainOptions()
11+
12+
var DefaultSecurity = ChainOptions(
13+
Security(noise.ID, noise.New),
14+
)

defaults_shared.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import (
1111
"github.com/libp2p/go-libp2p/p2p/muxer/yamux"
1212
"github.com/libp2p/go-libp2p/p2p/net/connmgr"
1313
"github.com/libp2p/go-libp2p/p2p/net/swarm"
14-
"github.com/libp2p/go-libp2p/p2p/security/noise"
15-
tls "github.com/libp2p/go-libp2p/p2p/security/tls"
1614
"github.com/prometheus/client_golang/prometheus"
1715

1816
"github.com/multiformats/go-multiaddr"
@@ -22,10 +20,6 @@ import (
2220
//
2321
// Useful when you want to extend, but not replace, the supported transport
2422
// security protocols.
25-
var DefaultSecurity = ChainOptions(
26-
Security(tls.ID, tls.New),
27-
Security(noise.ID, noise.New),
28-
)
2923

3024
// DefaultMuxers configures libp2p to use the stream connection multiplexers.
3125
//

p2p/security/tls/crypto.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build !js
2+
// +build !js
3+
14
package libp2ptls
25

36
import (

p2p/security/tls/transport.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build !js
2+
// +build !js
3+
14
package libp2ptls
25

36
import (

p2p/security/tls/transport_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build !js
2+
// +build !js
3+
14
package libp2ptls
25

36
import (

0 commit comments

Comments
 (0)