summaryrefslogtreecommitdiffstats
path: root/src/api/peers.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-27 05:02:39 +0100
committertv <tv@krebsco.de>2026-10-27 05:03:29 +0100
commitb5f756c3f623c41830aa6129a0fd63bd3f99a7ba (patch)
tree9faeb383fc899bf499749e843d4d4fb65b08adfd /src/api/peers.rs
parent16d7da71c49b62dd975957e5694088b8b084f244 (diff)
add transport stats
Diffstat (limited to 'src/api/peers.rs')
-rw-r--r--src/api/peers.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/api/peers.rs b/src/api/peers.rs
index 9e907ac..ac73296 100644
--- a/src/api/peers.rs
+++ b/src/api/peers.rs
@@ -17,6 +17,7 @@ use crate::document::store;
use crate::locks::MutexExt;
use crate::state::{AppState, HelloState, Incidents, Liveness};
use crate::swarm::peer::forgotten_path;
+use crate::transport::Destination;
use crate::transport::traffic::PeerTraffic;
#[derive(Debug, Serialize)]
@@ -50,6 +51,9 @@ pub(crate) struct PeerStatus {
alias: Option<String>,
/// Where this node reaches it, or would (`Transport::addresses_of`).
addresses: Vec<String>,
+ /// Where messages to it go now: the address, whether the peer proved itself there,
+ /// and the connection there (libp2p: direct or relayed). Absent if nowhere.
+ destination: Option<Destination>,
validated_swarm: Option<String>,
status: PeerLivenessStatus,
handshake_complete: bool,
@@ -146,11 +150,13 @@ pub(crate) async fn list_peers(
let alias = aliases.remove(&peer);
let addresses = state.transport.addresses_of(&peer);
+ let destination = state.transport.destination(&peer);
peers.insert(
peer,
PeerStatus {
alias,
addresses,
+ destination,
validated_swarm: ps.standing.swarm_id().map(str::to_owned),
status,
handshake_complete: ps.hello_state == HelloState::Established,