Skip to content

Commit

Permalink
Pass transport constructor to libp2p.Security function
Browse files Browse the repository at this point in the history
`go-libp2p` versions prior to `v0.24.0` allowed to pass either a constructed
security transport instance or a constructor producing such an instance.
Starting from `v0.24.0` only the latter option is supported.

See: https://github.com/libp2p/go-libp2p/releases/tag/v0.24.0
  • Loading branch information
lukasz-zimnoch committed Feb 6, 2024
1 parent 50b6bd6 commit 110fbb3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/net/libp2p/libp2p.go
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/libp2p/go-libp2p/core/host"
libp2pnet "github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/sec"
rhost "github.com/libp2p/go-libp2p/p2p/host/routed"
connmgr "github.com/libp2p/go-libp2p/p2p/net/connmgr"

Expand Down Expand Up @@ -415,7 +416,12 @@ func discoverAndListen(
options := []libp2p.Option{
libp2p.ListenAddrs(addrs...),
libp2p.Identity(identity.privKey),
libp2p.Security(handshakeID, transport),
libp2p.Security(
handshakeID,
func() sec.SecureTransport {
return transport
},
),
libp2p.ConnectionManager(connectionManager),
}

Expand Down

0 comments on commit 110fbb3

Please sign in to comment.