Skip to content

Commit

Permalink
P2P: Disable circuit relaying via libp2p.NoListenAddrs (#6064)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmalouf committed Jul 12, 2024
1 parent 5869a00 commit 1493410
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions network/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ func MakeHost(cfg config.Local, datadir string, pstore *pstore.PeerStore) (host.
listenAddr = "/ip4/0.0.0.0/tcp/0"
}

// the libp2p.NoListenAddrs builtin disables relays but this one does not
var noListenAddrs = func(cfg *libp2p.Config) error {
cfg.ListenAddrs = []multiaddr.Multiaddr{}
return nil
}

var disableMetrics = func(cfg *libp2p.Config) error { return nil }
metrics.DefaultRegistry().Register(&metrics.PrometheusDefaultMetrics)

Expand All @@ -130,7 +124,7 @@ func MakeHost(cfg config.Local, datadir string, pstore *pstore.PeerStore) (host.
libp2p.Transport(tcp.NewTCPTransport),
libp2p.Muxer("/yamux/1.0.0", &ymx),
libp2p.Peerstore(pstore),
noListenAddrs,
libp2p.NoListenAddrs,
libp2p.Security(noise.ID, noise.New),
disableMetrics,
)
Expand Down

0 comments on commit 1493410

Please sign in to comment.