Skip to content

Commit

Permalink
Correct /nat API for libp2p (#6677)
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 6fefd83
Author: Age Manning <Age@AgeManning.com>
Date:   Tue Dec 10 16:28:03 2024 +1100

    Fix nat API
  • Loading branch information
michaelsproul committed Dec 13, 2024
1 parent 4aaab3d commit 819f1ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ impl<E: EthSpec> NetworkBehaviour for PeerManager<E> {
debug!(self.log, "Failed to dial peer"; "peer_id"=> ?peer_id, "error" => %ClearDialError(error));
self.on_dial_failure(peer_id);
}
FromSwarm::ExternalAddrConfirmed(_) => {
// We have an external address confirmed, means we are able to do NAT traversal.
metrics::set_gauge_vec(&metrics::NAT_OPEN, &["libp2p"], 1);
}
_ => {
// NOTE: FromSwarm is a non exhaustive enum so updates should be based on release
// notes more than compiler feedback
Expand Down
4 changes: 2 additions & 2 deletions common/system_health/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,14 @@ pub fn observe_nat() -> NatState {

let libp2p_ipv4 = lighthouse_network::metrics::get_int_gauge(
&lighthouse_network::metrics::NAT_OPEN,
&["libp2p"],
&["libp2p_ipv4"],
)
.map(|g| g.get() == 1)
.unwrap_or_default();

let libp2p_ipv6 = lighthouse_network::metrics::get_int_gauge(
&lighthouse_network::metrics::NAT_OPEN,
&["libp2p"],
&["libp2p_ipv6"],
)
.map(|g| g.get() == 1)
.unwrap_or_default();
Expand Down

0 comments on commit 819f1ed

Please sign in to comment.