mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
Update to latest discovery (#6486)
* Upgrade discv5 to v0.8 * Rename some logs * Improve the NAT reporting with new discv5 metrics * Merge branch 'unstable' into discv5-v8 * Limited Cargo.lock update * Update yanked futures-* crates
This commit is contained in:
125
Cargo.lock
generated
125
Cargo.lock
generated
@@ -230,9 +230,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rlp"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62"
|
||||
checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f"
|
||||
dependencies = [
|
||||
"alloy-rlp-derive",
|
||||
"arrayvec",
|
||||
@@ -241,9 +241,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rlp-derive"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c"
|
||||
checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1952,6 +1952,17 @@ dependencies = [
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "delay_map"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df941644b671f05f59433e481ba0d31ac10e3667de725236a4c0d587c496fba1"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deposit_contract"
|
||||
version = "0.2.0"
|
||||
@@ -2186,20 +2197,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "discv5"
|
||||
version = "0.7.0"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f569b8c367554666c8652305621e8bae3634a2ff5c6378081d5bd8c399c99f23"
|
||||
checksum = "898d136ecb64116ec68aecf14d889bd30f8b1fe0c19e262953f7388dbe77052e"
|
||||
dependencies = [
|
||||
"aes 0.8.4",
|
||||
"aes-gcm",
|
||||
"alloy-rlp",
|
||||
"arrayvec",
|
||||
"ctr 0.9.2",
|
||||
"delay_map",
|
||||
"delay_map 0.4.0",
|
||||
"enr",
|
||||
"fnv",
|
||||
"futures",
|
||||
"hashlink 0.8.4",
|
||||
"hashlink 0.9.1",
|
||||
"hex",
|
||||
"hkdf",
|
||||
"lazy_static",
|
||||
@@ -2207,13 +2218,13 @@ dependencies = [
|
||||
"lru",
|
||||
"more-asserts",
|
||||
"multiaddr",
|
||||
"parking_lot 0.11.2",
|
||||
"parking_lot 0.12.3",
|
||||
"rand",
|
||||
"smallvec",
|
||||
"socket2 0.4.10",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"uint",
|
||||
"uint 0.10.0",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
@@ -2410,12 +2421,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "enr"
|
||||
version = "0.12.1"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "972070166c68827e64bd1ebc8159dd8e32d9bc2da7ebe8f20b61308f7974ad30"
|
||||
checksum = "851bd664a3d3a3c175cff92b2f0df02df3c541b4895d0ae307611827aae46152"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"base64 0.21.7",
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"ed25519-dalek",
|
||||
"hex",
|
||||
@@ -2708,7 +2719,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sha3 0.9.1",
|
||||
"thiserror",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2725,7 +2736,7 @@ dependencies = [
|
||||
"serde_json",
|
||||
"sha3 0.10.8",
|
||||
"thiserror",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2767,7 +2778,7 @@ dependencies = [
|
||||
"impl-rlp",
|
||||
"impl-serde 0.3.2",
|
||||
"primitive-types 0.10.1",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2783,7 +2794,7 @@ dependencies = [
|
||||
"impl-serde 0.4.0",
|
||||
"primitive-types 0.12.2",
|
||||
"scale-info",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3297,9 +3308,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
||||
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-sink",
|
||||
@@ -3307,9 +3318,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||
checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
@@ -3325,9 +3336,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
||||
checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6"
|
||||
|
||||
[[package]]
|
||||
name = "futures-lite"
|
||||
@@ -3341,9 +3352,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3363,15 +3374,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
||||
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
||||
checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988"
|
||||
|
||||
[[package]]
|
||||
name = "futures-ticker"
|
||||
@@ -3392,9 +3403,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.30"
|
||||
version = "0.3.31"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
|
||||
dependencies = [
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
@@ -3753,7 +3764,7 @@ dependencies = [
|
||||
"ipnet",
|
||||
"once_cell",
|
||||
"rand",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"thiserror",
|
||||
"tinyvec",
|
||||
"tokio",
|
||||
@@ -4009,7 +4020,7 @@ dependencies = [
|
||||
"httpdate",
|
||||
"itoa",
|
||||
"pin-project-lite",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tower-service",
|
||||
"tracing",
|
||||
@@ -4339,7 +4350,7 @@ version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f"
|
||||
dependencies = [
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"widestring 1.1.0",
|
||||
"windows-sys 0.48.0",
|
||||
"winreg",
|
||||
@@ -4805,7 +4816,7 @@ dependencies = [
|
||||
"libp2p-swarm",
|
||||
"rand",
|
||||
"smallvec",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tracing",
|
||||
"void",
|
||||
@@ -4906,7 +4917,7 @@ dependencies = [
|
||||
"rand",
|
||||
"ring 0.17.8",
|
||||
"rustls 0.23.13",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -4960,7 +4971,7 @@ dependencies = [
|
||||
"libc",
|
||||
"libp2p-core",
|
||||
"libp2p-identity",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
@@ -5146,7 +5157,7 @@ dependencies = [
|
||||
"alloy-rlp",
|
||||
"async-channel",
|
||||
"bytes",
|
||||
"delay_map",
|
||||
"delay_map 0.3.0",
|
||||
"directory",
|
||||
"dirs",
|
||||
"discv5",
|
||||
@@ -5715,7 +5726,7 @@ dependencies = [
|
||||
"beacon_chain",
|
||||
"beacon_processor",
|
||||
"bls",
|
||||
"delay_map",
|
||||
"delay_map 0.3.0",
|
||||
"derivative",
|
||||
"error-chain",
|
||||
"eth2",
|
||||
@@ -6502,7 +6513,7 @@ dependencies = [
|
||||
"impl-codec 0.5.1",
|
||||
"impl-rlp",
|
||||
"impl-serde 0.3.2",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6516,7 +6527,7 @@ dependencies = [
|
||||
"impl-rlp",
|
||||
"impl-serde 0.4.0",
|
||||
"scale-info",
|
||||
"uint",
|
||||
"uint 0.9.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -6731,7 +6742,7 @@ dependencies = [
|
||||
"quinn-udp",
|
||||
"rustc-hash 2.0.0",
|
||||
"rustls 0.23.13",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
@@ -6762,7 +6773,7 @@ checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"once_cell",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tracing",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
@@ -8080,16 +8091,6 @@ dependencies = [
|
||||
"subtle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.7"
|
||||
@@ -8692,7 +8693,7 @@ dependencies = [
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
@@ -8748,7 +8749,7 @@ dependencies = [
|
||||
"postgres-protocol",
|
||||
"postgres-types",
|
||||
"rand",
|
||||
"socket2 0.5.7",
|
||||
"socket2",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"whoami",
|
||||
@@ -9128,6 +9129,18 @@ dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uint"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"crunchy",
|
||||
"hex",
|
||||
"static_assertions",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unarray"
|
||||
version = "0.1.4"
|
||||
|
||||
@@ -127,7 +127,7 @@ derivative = "2"
|
||||
dirs = "3"
|
||||
either = "1.9"
|
||||
rust_eth_kzg = "0.5.1"
|
||||
discv5 = { version = "0.7", features = ["libp2p"] }
|
||||
discv5 = { version = "0.9", features = ["libp2p"] }
|
||||
env_logger = "0.9"
|
||||
error-chain = "0.12"
|
||||
ethereum_hashing = "0.7.0"
|
||||
|
||||
@@ -305,12 +305,12 @@ impl Default for Config {
|
||||
let discv5_config = discv5::ConfigBuilder::new(discv5_listen_config)
|
||||
.enable_packet_filter()
|
||||
.session_cache_capacity(5000)
|
||||
.request_timeout(Duration::from_secs(1))
|
||||
.request_timeout(Duration::from_secs(2))
|
||||
.query_peer_timeout(Duration::from_secs(2))
|
||||
.query_timeout(Duration::from_secs(30))
|
||||
.request_retries(1)
|
||||
.enr_peer_update_min(10)
|
||||
.query_parallelism(5)
|
||||
.query_parallelism(8)
|
||||
.disable_report_discovered_peers()
|
||||
.ip_limit() // limits /24 IP's in buckets.
|
||||
.incoming_bucket_limit(8) // half the bucket size
|
||||
|
||||
@@ -1052,10 +1052,6 @@ impl<E: EthSpec> NetworkBehaviour for Discovery<E> {
|
||||
discv5::Event::SocketUpdated(socket_addr) => {
|
||||
info!(self.log, "Address updated"; "ip" => %socket_addr.ip(), "udp_port" => %socket_addr.port());
|
||||
metrics::inc_counter(&metrics::ADDRESS_UPDATE_COUNT);
|
||||
// We have SOCKET_UPDATED messages. This occurs when discovery has a majority of
|
||||
// users reporting an external port and our ENR gets updated.
|
||||
// Which means we are able to do NAT traversal.
|
||||
metrics::set_gauge_vec(&metrics::NAT_OPEN, &["discv5"], 1);
|
||||
// Discv5 will have updated our local ENR. We save the updated version
|
||||
// to disk.
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ pub static NAT_OPEN: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
|
||||
&["protocol"],
|
||||
)
|
||||
});
|
||||
|
||||
pub static ADDRESS_UPDATE_COUNT: LazyLock<Result<IntCounter>> = LazyLock::new(|| {
|
||||
try_create_int_counter(
|
||||
"libp2p_address_update_total",
|
||||
@@ -212,4 +213,6 @@ pub fn scrape_discovery_metrics() {
|
||||
set_gauge(&DISCOVERY_SESSIONS, metrics.active_sessions as i64);
|
||||
set_gauge_vec(&DISCOVERY_BYTES, &["inbound"], metrics.bytes_recv as i64);
|
||||
set_gauge_vec(&DISCOVERY_BYTES, &["outbound"], metrics.bytes_sent as i64);
|
||||
set_gauge_vec(&NAT_OPEN, &["discv5_ipv4"], metrics.ipv4_contactable as i64);
|
||||
set_gauge_vec(&NAT_OPEN, &["discv5_ipv6"], metrics.ipv6_contactable as i64);
|
||||
}
|
||||
|
||||
@@ -7,10 +7,12 @@ use futures::StreamExt;
|
||||
use libp2p::core::transport::PortUse;
|
||||
use libp2p::core::ConnectedPoint;
|
||||
use libp2p::identity::PeerId;
|
||||
use libp2p::multiaddr::Protocol;
|
||||
use libp2p::swarm::behaviour::{ConnectionClosed, ConnectionEstablished, DialFailure, FromSwarm};
|
||||
use libp2p::swarm::dial_opts::{DialOpts, PeerCondition};
|
||||
use libp2p::swarm::dummy::ConnectionHandler;
|
||||
use libp2p::swarm::{ConnectionDenied, ConnectionId, NetworkBehaviour, ToSwarm};
|
||||
pub use metrics::{set_gauge_vec, NAT_OPEN};
|
||||
use slog::{debug, error, trace};
|
||||
use types::EthSpec;
|
||||
|
||||
@@ -160,8 +162,8 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
|
||||
) -> Result<(), ConnectionDenied> {
|
||||
// get the IP address to verify it's not banned.
|
||||
let ip = match remote_addr.iter().next() {
|
||||
Some(libp2p::multiaddr::Protocol::Ip6(ip)) => IpAddr::V6(ip),
|
||||
Some(libp2p::multiaddr::Protocol::Ip4(ip)) => IpAddr::V4(ip),
|
||||
Some(Protocol::Ip6(ip)) => IpAddr::V6(ip),
|
||||
Some(Protocol::Ip4(ip)) => IpAddr::V4(ip),
|
||||
_ => {
|
||||
return Err(ConnectionDenied::new(format!(
|
||||
"Connection to peer rejected: invalid multiaddr: {remote_addr}"
|
||||
@@ -207,6 +209,14 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
|
||||
));
|
||||
}
|
||||
|
||||
// We have an inbound connection, this is indicative of having our libp2p NAT ports open. We
|
||||
// distinguish between ipv4 and ipv6 here:
|
||||
match remote_addr.iter().next() {
|
||||
Some(Protocol::Ip4(_)) => set_gauge_vec(&NAT_OPEN, &["libp2p_ipv4"], 1),
|
||||
Some(Protocol::Ip6(_)) => set_gauge_vec(&NAT_OPEN, &["libp2p_ipv6"], 1),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Ok(ConnectionHandler)
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ pub async fn run<E: EthSpec>(
|
||||
"active_sessions" => metrics.active_sessions,
|
||||
"requests/s" => format_args!("{:.2}", metrics.unsolicited_requests_per_second),
|
||||
"ipv4_nodes" => ipv4_only_reachable,
|
||||
"ipv6_nodes" => ipv6_only_reachable,
|
||||
"ipv6_and_ipv4_nodes" => ipv4_ipv6_reachable,
|
||||
"ipv6_only_nodes" => ipv6_only_reachable,
|
||||
"dual_stack_nodes" => ipv4_ipv6_reachable,
|
||||
"unreachable_nodes" => unreachable_nodes,
|
||||
);
|
||||
|
||||
|
||||
@@ -198,23 +198,61 @@ pub fn observe_system_health_vc(
|
||||
}
|
||||
}
|
||||
|
||||
/// The current state of Lighthouse NAT/connectivity.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct NatState {
|
||||
/// Contactable on discovery ipv4.
|
||||
discv5_ipv4: bool,
|
||||
/// Contactable on discovery ipv6.
|
||||
discv5_ipv6: bool,
|
||||
/// Contactable on libp2p ipv4.
|
||||
libp2p_ipv4: bool,
|
||||
/// Contactable on libp2p ipv6.
|
||||
libp2p_ipv6: bool,
|
||||
}
|
||||
|
||||
impl NatState {
|
||||
pub fn is_anything_open(&self) -> bool {
|
||||
self.discv5_ipv4 || self.discv5_ipv6 || self.libp2p_ipv4 || self.libp2p_ipv6
|
||||
}
|
||||
}
|
||||
|
||||
/// Observes if NAT traversal is possible.
|
||||
pub fn observe_nat() -> bool {
|
||||
let discv5_nat = lighthouse_network::metrics::get_int_gauge(
|
||||
pub fn observe_nat() -> NatState {
|
||||
let discv5_ipv4 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
&["discv5"],
|
||||
&["discv5_ipv4"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let libp2p_nat = lighthouse_network::metrics::get_int_gauge(
|
||||
let discv5_ipv6 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
&["discv5_ipv6"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let libp2p_ipv4 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
&["libp2p"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
discv5_nat || libp2p_nat
|
||||
let libp2p_ipv6 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
&["libp2p"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
NatState {
|
||||
discv5_ipv4,
|
||||
discv5_ipv6,
|
||||
libp2p_ipv4,
|
||||
libp2p_ipv6,
|
||||
}
|
||||
}
|
||||
|
||||
/// Observes the Beacon Node system health.
|
||||
@@ -242,7 +280,7 @@ pub fn observe_system_health_bn<E: EthSpec>(
|
||||
.unwrap_or_else(|| (String::from("None"), 0, 0));
|
||||
|
||||
// Determine if the NAT is open or not.
|
||||
let nat_open = observe_nat();
|
||||
let nat_open = observe_nat().is_anything_open();
|
||||
|
||||
SystemHealthBN {
|
||||
system_health,
|
||||
|
||||
Reference in New Issue
Block a user