mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
UX Network Fixes (#6796)
There were two things I came across during some recent testing, that this PR addresses. 1 - The default port for IPv6 was set to 9090, which is confusing. I've set this to match its ipv4 counterpart (i.e 9000 and 9001). This makes more sense and is easier to firewall, for those firewalls that support both versions for a single rule. 2 - Watching the NAT status of lighthouse, I notice we only set the field to 1 once the NAT is passed. We don't give it a default 0 (false). So we only see results when its successful. On peer disconnects, i've piggy-backed a loop of the connected peers to also watch and check for NAT status updates.
This commit is contained in:
@@ -176,8 +176,7 @@ pub fn cli_app() -> Command {
|
|||||||
.long("port6")
|
.long("port6")
|
||||||
.value_name("PORT")
|
.value_name("PORT")
|
||||||
.help("The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 and \
|
.help("The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 and \
|
||||||
IPv6. Defaults to 9090 when required. The Quic UDP port will be set to this value + 1.")
|
IPv6. Defaults to --port. The Quic UDP port will be set to this value + 1.")
|
||||||
.default_value("9090")
|
|
||||||
.action(ArgAction::Set)
|
.action(ArgAction::Set)
|
||||||
.display_order(0)
|
.display_order(0)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -936,12 +936,11 @@ pub fn parse_listening_addresses(
|
|||||||
.expect("--port has a default value")
|
.expect("--port has a default value")
|
||||||
.parse::<u16>()
|
.parse::<u16>()
|
||||||
.map_err(|parse_error| format!("Failed to parse --port as an integer: {parse_error}"))?;
|
.map_err(|parse_error| format!("Failed to parse --port as an integer: {parse_error}"))?;
|
||||||
let port6 = cli_args
|
let maybe_port6 = cli_args
|
||||||
.get_one::<String>("port6")
|
.get_one::<String>("port6")
|
||||||
.map(|s| str::parse::<u16>(s))
|
.map(|s| str::parse::<u16>(s))
|
||||||
.transpose()
|
.transpose()
|
||||||
.map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))?
|
.map_err(|parse_error| format!("Failed to parse --port6 as an integer: {parse_error}"))?;
|
||||||
.unwrap_or(9090);
|
|
||||||
|
|
||||||
// parse the possible discovery ports.
|
// parse the possible discovery ports.
|
||||||
let maybe_disc_port = cli_args
|
let maybe_disc_port = cli_args
|
||||||
@@ -989,6 +988,10 @@ pub fn parse_listening_addresses(
|
|||||||
warn!(log, "When listening only over IPv6, use the --port flag. The value of --port6 will be ignored.");
|
warn!(log, "When listening only over IPv6, use the --port flag. The value of --port6 will be ignored.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we are only listening on ipv6 and the user has specified --port6, lets just use
|
||||||
|
// that.
|
||||||
|
let port = maybe_port6.unwrap_or(port);
|
||||||
|
|
||||||
// use zero ports if required. If not, use the given port.
|
// use zero ports if required. If not, use the given port.
|
||||||
let tcp_port = use_zero_ports
|
let tcp_port = use_zero_ports
|
||||||
.then(unused_port::unused_tcp6_port)
|
.then(unused_port::unused_tcp6_port)
|
||||||
@@ -1055,6 +1058,9 @@ pub fn parse_listening_addresses(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
(Some(ipv4), Some(ipv6)) => {
|
(Some(ipv4), Some(ipv6)) => {
|
||||||
|
// If --port6 is not set, we use --port
|
||||||
|
let port6 = maybe_port6.unwrap_or(port);
|
||||||
|
|
||||||
let ipv4_tcp_port = use_zero_ports
|
let ipv4_tcp_port = use_zero_ports
|
||||||
.then(unused_port::unused_tcp4_port)
|
.then(unused_port::unused_tcp4_port)
|
||||||
.transpose()?
|
.transpose()?
|
||||||
@@ -1074,7 +1080,7 @@ pub fn parse_listening_addresses(
|
|||||||
ipv4_tcp_port + 1
|
ipv4_tcp_port + 1
|
||||||
});
|
});
|
||||||
|
|
||||||
// Defaults to 9090 when required
|
// Defaults to 9000 when required
|
||||||
let ipv6_tcp_port = use_zero_ports
|
let ipv6_tcp_port = use_zero_ports
|
||||||
.then(unused_port::unused_tcp6_port)
|
.then(unused_port::unused_tcp6_port)
|
||||||
.transpose()?
|
.transpose()?
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ To listen over both IPv4 and IPv6:
|
|||||||
>
|
>
|
||||||
> **IPv6**:
|
> **IPv6**:
|
||||||
>
|
>
|
||||||
> It listens on the default value of --port6 (`9090`) for both UDP and TCP.
|
> It listens on the default value of --port6 (`9000`) for both UDP and TCP.
|
||||||
> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1.
|
> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1.
|
||||||
|
|
||||||
> When using `--listen-address :: --listen-address --port 9909 --discovery-port6 9999`, listening will be set up as follows:
|
> When using `--listen-address :: --listen-address --port 9909 --discovery-port6 9999`, listening will be set up as follows:
|
||||||
>
|
>
|
||||||
@@ -174,8 +174,8 @@ To listen over both IPv4 and IPv6:
|
|||||||
>
|
>
|
||||||
> **IPv6**:
|
> **IPv6**:
|
||||||
>
|
>
|
||||||
> It listens on the default value of `--port6` (`9090`) for TCP, and port `9999` for UDP.
|
> It listens on the default value of `--port6` (`9000`) for TCP, and port `9999` for UDP.
|
||||||
> QUIC will use port `9091` for UDP, which is the default `--port6` value (`9090`) + 1.
|
> QUIC will use port `9001` for UDP, which is the default `--port6` value (`9000`) + 1.
|
||||||
|
|
||||||
### Configuring Lighthouse to advertise IPv6 reachable addresses
|
### Configuring Lighthouse to advertise IPv6 reachable addresses
|
||||||
|
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ Options:
|
|||||||
[default: 9000]
|
[default: 9000]
|
||||||
--port6 <PORT>
|
--port6 <PORT>
|
||||||
The TCP/UDP ports to listen on over IPv6 when listening over both IPv4
|
The TCP/UDP ports to listen on over IPv6 when listening over both IPv4
|
||||||
and IPv6. Defaults to 9090 when required. The Quic UDP port will be
|
and IPv6. Defaults to --port. The Quic UDP port will be set to this
|
||||||
set to this value + 1. [default: 9090]
|
value + 1.
|
||||||
--prepare-payload-lookahead <MILLISECONDS>
|
--prepare-payload-lookahead <MILLISECONDS>
|
||||||
The time before the start of a proposal slot at which payload
|
The time before the start of a proposal slot at which payload
|
||||||
attributes should be sent. Low values are useful for execution nodes
|
attributes should be sent. Low values are useful for execution nodes
|
||||||
|
|||||||
Reference in New Issue
Block a user