mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-01 20:04:41 +00:00
Crate network_utils crate
This commit is contained in:
@@ -5,6 +5,8 @@ edition = { workspace = true }
|
||||
|
||||
[dependencies]
|
||||
lighthouse_network = { workspace = true }
|
||||
metrics = { workspace = true }
|
||||
network_utils = { workspace = true }
|
||||
parking_lot = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
sysinfo = { workspace = true }
|
||||
|
||||
@@ -4,6 +4,7 @@ use serde::{Deserialize, Serialize};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use sysinfo::{CpuExt, DiskExt, NetworkExt, NetworksExt, System, SystemExt};
|
||||
use network_utils::discovery_metrics;
|
||||
use types::EthSpec;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
@@ -219,29 +220,29 @@ impl NatState {
|
||||
|
||||
/// Observes if NAT traversal is possible.
|
||||
pub fn observe_nat() -> NatState {
|
||||
let discv5_ipv4 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
let discv5_ipv4 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["discv5_ipv4"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let discv5_ipv6 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
let discv5_ipv6 = metrics::get_int_gauge(
|
||||
&discovery_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,
|
||||
let libp2p_ipv4 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["libp2p_ipv4"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let libp2p_ipv6 = lighthouse_network::metrics::get_int_gauge(
|
||||
&lighthouse_network::metrics::NAT_OPEN,
|
||||
let libp2p_ipv6 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["libp2p_ipv6"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
|
||||
Reference in New Issue
Block a user