mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
Add UPnP support for Lighthouse (#1587)
Adding UPnP support will help grow the DHT by allowing NAT traversal for peers with UPnP supported routers. ## Issue Addressed #927 ## Proposed Changes Using IGD library: https://docs.rs/igd/0.10.0/igd/ Adding the the libp2p tcp port and discovery udp port. If this fails it simply logs the attempt and moves on ## Additional Info Co-authored-by: Age Manning <Age@AgeManning.com>
This commit is contained in:
@@ -75,6 +75,12 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
||||
.help("One or more comma-delimited base64-encoded ENR's to bootstrap the p2p network. Multiaddr is also supported.")
|
||||
.takes_value(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("disable-upnp")
|
||||
.long("disable-upnp")
|
||||
.help("Disables UPnP support. Setting this will prevent Lighthouse from attempting to automatically establish external port mappings.")
|
||||
.takes_value(false),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("enr-udp-port")
|
||||
.long("enr-udp-port")
|
||||
|
||||
@@ -474,7 +474,7 @@ pub fn set_network_config(
|
||||
config.enr_address = Some(resolved_addr);
|
||||
}
|
||||
|
||||
if cli_args.is_present("disable_enr_auto_update") {
|
||||
if cli_args.is_present("disable-enr-auto-update") {
|
||||
config.discv5_config.enr_update = false;
|
||||
}
|
||||
|
||||
@@ -483,6 +483,10 @@ pub fn set_network_config(
|
||||
warn!(log, "Discovery is disabled. New peers will not be found");
|
||||
}
|
||||
|
||||
if cli_args.is_present("disable-upnp") {
|
||||
config.upnp_enabled = false;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user