pub struct Capabilities {Show 13 fields
pub supports_relay: bool,
pub supports_coordination: bool,
pub observed_addrs: Vec<SocketAddr>,
pub protocols: Vec<ProtocolId>,
pub last_seen: SystemTime,
pub rtt_ms_p50: u32,
pub rtt_jitter_ms: u32,
pub packet_loss: f32,
pub nat_type_hint: Option<NatHint>,
pub bandwidth_limit: Option<u64>,
pub successful_connections: u32,
pub failed_connections: u32,
pub is_connected: bool,
}Expand description
Capabilities and quality metrics for a connected peer.
This struct captures both static capabilities (what the peer can do) and dynamic metrics (how well the peer is performing).
Fields§
§supports_relay: boolWhether this peer can relay traffic for NAT traversal.
supports_coordination: boolWhether this peer can coordinate NAT hole-punching.
observed_addrs: Vec<SocketAddr>Observed external addresses for this peer.
protocols: Vec<ProtocolId>Protocols this peer advertises support for.
last_seen: SystemTimeLast time we successfully communicated with this peer.
rtt_ms_p50: u32Median round-trip time in milliseconds (p50).
rtt_jitter_ms: u32Estimated RTT jitter in milliseconds.
packet_loss: f32Packet loss rate (0.0 to 1.0).
nat_type_hint: Option<NatHint>Inferred NAT type for connection strategy hints.
bandwidth_limit: Option<u64>Peer’s advertised bandwidth limit (bytes/sec), if any.
successful_connections: u32Number of successful connections to this peer.
failed_connections: u32Number of failed connection attempts to this peer.
is_connected: boolWhether this peer is currently connected.
Implementations§
Source§impl Capabilities
impl Capabilities
Sourcepub fn new_connected(addr: SocketAddr) -> Self
pub fn new_connected(addr: SocketAddr) -> Self
Create capabilities for a newly connected peer.
Sourcepub fn quality_score(&self) -> f32
pub fn quality_score(&self) -> f32
Calculate a quality score for peer selection (0.0 to 1.0).
Higher scores indicate better peers for connection.
Sourcepub fn supports_protocol(&self, proto: &ProtocolId) -> bool
pub fn supports_protocol(&self, proto: &ProtocolId) -> bool
Check if this peer supports a specific protocol.
Trait Implementations§
Source§impl Clone for Capabilities
impl Clone for Capabilities
Source§fn clone(&self) -> Capabilities
fn clone(&self) -> Capabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more