pub struct PathInfo {
pub name: String,
pub local_addr: String,
pub bandwidth_mbps: u32,
pub latency_ms: u32,
pub active: bool,
pub packets_sent: u64,
pub packets_lost: u64,
pub srtt: Option<Duration>,
pub last_used: Option<Instant>,
}Expand description
Information about a single network path (interface).
Fields§
§name: StringHuman-readable name (e.g. “wifi”, “lte”, “eth0”).
local_addr: StringLocal IP address bound to this interface.
bandwidth_mbps: u32Estimated bandwidth in Mbps.
latency_ms: u32Estimated latency in milliseconds.
active: boolWhether this path is currently active.
packets_sent: u64Number of packets sent on this path.
packets_lost: u64Number of packets lost on this path (estimated).
srtt: Option<Duration>Smoothed RTT for this path.
last_used: Option<Instant>When this path was last used.
Implementations§
Source§impl PathInfo
impl PathInfo
Sourcepub fn new(
name: &str,
local_addr: &str,
bandwidth_mbps: u32,
latency_ms: u32,
) -> Self
pub fn new( name: &str, local_addr: &str, bandwidth_mbps: u32, latency_ms: u32, ) -> Self
Create a new path with name, local address, bandwidth, and latency.
Sourcepub fn score(&self) -> f64
pub fn score(&self) -> f64
Compute a score for path selection — higher is better. Score = bandwidth / latency, penalized by loss rate.
Sourcepub fn update_srtt(&mut self, rtt: Duration)
pub fn update_srtt(&mut self, rtt: Duration)
Update SRTT for this path using RFC 6298 smoothing.
Sourcepub fn record_sent(&mut self)
pub fn record_sent(&mut self)
Mark this path as having sent a packet.
Sourcepub fn record_loss(&mut self)
pub fn record_loss(&mut self)
Mark a packet as lost on this path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PathInfo
impl RefUnwindSafe for PathInfo
impl Send for PathInfo
impl Sync for PathInfo
impl Unpin for PathInfo
impl UnsafeUnpin for PathInfo
impl UnwindSafe for PathInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more