pub struct PeerInfo {
pub capabilities: Capabilities,
pub user_agent: String,
pub version: ProtocolVersion,
pub addr: PeerAddr,
pub direction: Direction,
pub live_info: Arc<RwLock<PeerLiveInfo>>,
}
Expand description
General information about a connected peer that’s useful to other modules.
Fields§
§capabilities: Capabilities
§user_agent: String
§version: ProtocolVersion
§addr: PeerAddr
§direction: Direction
§live_info: Arc<RwLock<PeerLiveInfo>>
Implementations§
source§impl PeerInfo
impl PeerInfo
sourcepub fn total_difficulty(&self) -> Difficulty
pub fn total_difficulty(&self) -> Difficulty
The current total_difficulty of the peer.
pub fn is_outbound(&self) -> bool
pub fn is_inbound(&self) -> bool
sourcepub fn first_seen(&self) -> DateTime<Utc>
pub fn first_seen(&self) -> DateTime<Utc>
Time of first_seen for this peer.
sourcepub fn update(&self, height: u64, total_difficulty: Difficulty)
pub fn update(&self, height: u64, total_difficulty: Difficulty)
Update the total_difficulty, height and last_seen of the peer. Takes a write lock on the live_info.
Trait Implementations§
source§impl From<PeerInfo> for PeerInfoDisplay
impl From<PeerInfo> for PeerInfoDisplay
source§fn from(info: PeerInfo) -> PeerInfoDisplay
fn from(info: PeerInfo) -> PeerInfoDisplay
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PeerInfo
impl !RefUnwindSafe for PeerInfo
impl Send for PeerInfo
impl Sync for PeerInfo
impl Unpin for PeerInfo
impl !UnwindSafe for PeerInfo
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<'a, T> DefaultFeatures<'a> for T
impl<'a, T> DefaultFeatures<'a> for T
source§fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a>>
fn clone_boxed(&self) -> Box<dyn DefaultFeatures<'a>>
Clone this value, and then immediately put it into a
Box
behind a trait object of this trait.source§impl<'a, T> NonSyncFeatures<'a> for Twhere
T: 'a + Clone,
impl<'a, T> NonSyncFeatures<'a> for Twhere
T: 'a + Clone,
source§fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a>>
fn clone_boxed(&self) -> Box<dyn NonSyncFeatures<'a>>
Clone this value, and then immediately put it into a
Box
behind a trait object of this trait.