mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-09 11:25:55 +00:00
Clean up
This commit is contained in:
@@ -13,6 +13,5 @@ parking_lot = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
tiny-keccak = { version = "2", features = ["keccak"] }
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
hex = { workspace = true }
|
||||
hex = { workspace = true }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::sync::LazyLock;
|
||||
use metrics::*;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub static NAT_OPEN: LazyLock<Result<IntGaugeVec>> = LazyLock::new(|| {
|
||||
try_create_int_gauge_vec(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod discovery_metrics;
|
||||
pub mod enr_ext;
|
||||
pub mod listen_addr;
|
||||
pub mod unused_port;
|
||||
pub mod discovery_metrics;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use lighthouse_network::{types::SyncState, NetworkGlobals};
|
||||
use network_utils::discovery_metrics;
|
||||
use parking_lot::RwLock;
|
||||
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)]
|
||||
@@ -220,33 +220,21 @@ impl NatState {
|
||||
|
||||
/// Observes if NAT traversal is possible.
|
||||
pub fn observe_nat() -> NatState {
|
||||
let discv5_ipv4 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["discv5_ipv4"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
let discv5_ipv4 = metrics::get_int_gauge(&discovery_metrics::NAT_OPEN, &["discv5_ipv4"])
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let discv5_ipv6 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["discv5_ipv6"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
let discv5_ipv6 = metrics::get_int_gauge(&discovery_metrics::NAT_OPEN, &["discv5_ipv6"])
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let libp2p_ipv4 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["libp2p_ipv4"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
let libp2p_ipv4 = metrics::get_int_gauge(&discovery_metrics::NAT_OPEN, &["libp2p_ipv4"])
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
let libp2p_ipv6 = metrics::get_int_gauge(
|
||||
&discovery_metrics::NAT_OPEN,
|
||||
&["libp2p_ipv6"],
|
||||
)
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
let libp2p_ipv6 = metrics::get_int_gauge(&discovery_metrics::NAT_OPEN, &["libp2p_ipv6"])
|
||||
.map(|g| g.get() == 1)
|
||||
.unwrap_or_default();
|
||||
|
||||
NatState {
|
||||
discv5_ipv4,
|
||||
|
||||
Reference in New Issue
Block a user