mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-23 23:04:53 +00:00
disable libp2p upnp (#5449)
* disable libp2p upnp when passing --disable-upnp cli flag
This commit is contained in:
@@ -29,6 +29,7 @@ use api_types::{PeerRequestId, Request, RequestId, Response};
|
||||
use futures::stream::StreamExt;
|
||||
use gossipsub_scoring_parameters::{lighthouse_gossip_thresholds, PeerScoreSettings};
|
||||
use libp2p::multiaddr::{self, Multiaddr, Protocol as MProtocol};
|
||||
use libp2p::swarm::behaviour::toggle::Toggle;
|
||||
use libp2p::swarm::{Swarm, SwarmEvent};
|
||||
use libp2p::{identify, PeerId, SwarmBuilder};
|
||||
use slog::{crit, debug, info, o, trace, warn};
|
||||
@@ -379,6 +380,11 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
||||
libp2p::connection_limits::Behaviour::new(limits)
|
||||
};
|
||||
|
||||
let upnp = Toggle::from(
|
||||
config
|
||||
.upnp_enabled
|
||||
.then_some(libp2p::upnp::tokio::Behaviour::default()),
|
||||
);
|
||||
let behaviour = {
|
||||
Behaviour {
|
||||
gossipsub,
|
||||
@@ -387,7 +393,7 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
||||
identify,
|
||||
peer_manager,
|
||||
connection_limits,
|
||||
upnp: Default::default(),
|
||||
upnp,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user