pub struct ContactEntry {
pub peer_id: PeerId,
pub addresses: Vec<String>,
pub last_seen: DateTime<Utc>,
pub quality_metrics: QualityMetrics,
pub capabilities: Vec<String>,
pub ipv6_identity_verified: bool,
pub reputation_score: f64,
pub connection_history: ConnectionHistory,
}
Expand description
A contact entry representing a known peer
Fields§
§peer_id: PeerId
Unique identifier for this peer
addresses: Vec<String>
List of network addresses where this peer can be reached
last_seen: DateTime<Utc>
Timestamp when this peer was last seen online
quality_metrics: QualityMetrics
Quality metrics for connection performance evaluation
capabilities: Vec<String>
List of capabilities supported by this peer
ipv6_identity_verified: bool
Whether this peer’s IPv6 identity has been verified
reputation_score: f64
Overall reputation score (0.0 to 1.0)
connection_history: ConnectionHistory
Historical connection data for this peer
Implementations§
Source§impl ContactEntry
impl ContactEntry
Sourcepub fn update_connection_result(
&mut self,
success: bool,
latency_ms: Option<u64>,
error: Option<String>,
)
pub fn update_connection_result( &mut self, success: bool, latency_ms: Option<u64>, error: Option<String>, )
Update quality metrics based on connection result
Sourcepub fn update_success_rate(&mut self)
pub fn update_success_rate(&mut self)
Update success rate
Sourcepub fn recalculate_quality_score(&mut self)
pub fn recalculate_quality_score(&mut self)
Recalculate overall quality score
Sourcepub fn update_capabilities(&mut self, capabilities: Vec<String>)
pub fn update_capabilities(&mut self, capabilities: Vec<String>)
Update capabilities
Sourcepub fn update_reputation(&mut self, reputation: f64)
pub fn update_reputation(&mut self, reputation: f64)
Update reputation score
Sourcepub fn mark_ipv6_verified(&mut self)
pub fn mark_ipv6_verified(&mut self)
Mark IPv6 identity as verified
Sourcepub fn age_seconds(&self) -> u64
pub fn age_seconds(&self) -> u64
Get contact age in seconds
Sourcepub fn has_capability(&self, capability: &str) -> bool
pub fn has_capability(&self, capability: &str) -> bool
Check if contact has essential capabilities
Trait Implementations§
Source§impl Clone for ContactEntry
impl Clone for ContactEntry
Source§fn clone(&self) -> ContactEntry
fn clone(&self) -> ContactEntry
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ContactEntry
impl Debug for ContactEntry
Source§impl<'de> Deserialize<'de> for ContactEntry
impl<'de> Deserialize<'de> for ContactEntry
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
Source§impl PartialEq for ContactEntry
impl PartialEq for ContactEntry
Source§impl Serialize for ContactEntry
impl Serialize for ContactEntry
impl StructuralPartialEq for ContactEntry
Auto Trait Implementations§
impl Freeze for ContactEntry
impl RefUnwindSafe for ContactEntry
impl Send for ContactEntry
impl Sync for ContactEntry
impl Unpin for ContactEntry
impl UnwindSafe for ContactEntry
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