From b5f756c3f623c41830aa6129a0fd63bd3f99a7ba Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 27 Oct 2026 05:02:39 +0100 Subject: add transport stats --- src/api/peers.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/api/peers.rs') 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, /// Where this node reaches it, or would (`Transport::addresses_of`). addresses: Vec, + /// 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, validated_swarm: Option, 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, -- cgit v1.3.1