Skip to content

Commit

Permalink
feat: add nat manager for p2p (#299)
Browse files Browse the repository at this point in the history
* feat: add nat manager for p2p

* feat: add noise security frame to p2p protocol
  • Loading branch information
joeylichang authored Apr 12, 2023
1 parent 0e8ecf3 commit ba002be
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/p2p/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/libp2p/go-libp2p/core/peerstore"
"github.com/libp2p/go-libp2p/core/protocol"
"github.com/libp2p/go-libp2p/p2p/host/peerstore/pstoreds"
"github.com/libp2p/go-libp2p/p2p/security/noise"

"github.com/bnb-chain/greenfield-storage-provider/pkg/log"
"github.com/bnb-chain/greenfield-storage-provider/pkg/p2p/types"
Expand Down Expand Up @@ -65,6 +66,9 @@ func NewNode(config *NodeConfig, SPAddr string, signer *signerclient.SignerClien
// to the same sp all fail and are replaced, then the sp will be unable to communicate, this requires
// dynamic updates permanent nodes
libp2p.Ping(false),
libp2p.NATPortMap(),
// support noise connections
libp2p.Security(noise.ID, noise.New),
libp2p.WithDialTimeout(time.Duration(DailTimeout)*time.Second),
)
if err != nil {
Expand Down

0 comments on commit ba002be

Please sign in to comment.