pub struct RelayScore {
pub relay_pubkey: [u8; 32],
pub success_count: u32,
pub failure_count: u32,
pub avg_latency_ms: u32,
pub last_probe_at: u64,
pub score: f32,
}Expand description
Client-side observed quality score for a relay.
Selection uses observed scores, not self-reported load.
Fields§
§relay_pubkey: [u8; 32]§success_count: u32§failure_count: u32§avg_latency_ms: u32§last_probe_at: u64§score: f32Computed score — higher is better. Range roughly -1.0 .. 1.0 for normalized scoring; new/unknown relays start at 0.0.
Implementations§
Source§impl RelayScore
impl RelayScore
Sourcepub fn new(relay_pubkey: [u8; 32], now_unix: u64) -> Self
pub fn new(relay_pubkey: [u8; 32], now_unix: u64) -> Self
Create a neutral score for a newly discovered relay.
Sourcepub fn record_success(&mut self, latency_ms: u32, now_unix: u64)
pub fn record_success(&mut self, latency_ms: u32, now_unix: u64)
Record a successful tunnel establishment / data transfer.
Sourcepub fn record_failure(&mut self, now_unix: u64)
pub fn record_failure(&mut self, now_unix: u64)
Record a failure (timeout, connection refused, etc.).
Sourcepub fn apply_decay(&mut self, now_unix: u64)
pub fn apply_decay(&mut self, now_unix: u64)
Apply time-based decay toward neutral (0.0).
Trait Implementations§
Source§impl Clone for RelayScore
impl Clone for RelayScore
Source§fn clone(&self) -> RelayScore
fn clone(&self) -> RelayScore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RelayScore
impl Debug for RelayScore
Source§impl<'de> Deserialize<'de> for RelayScore
impl<'de> Deserialize<'de> for RelayScore
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for RelayScore
impl RefUnwindSafe for RelayScore
impl Send for RelayScore
impl Sync for RelayScore
impl Unpin for RelayScore
impl UnsafeUnpin for RelayScore
impl UnwindSafe for RelayScore
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