pub struct Contact {
pub node: Node,
pub is_discv4: bool,
pub is_discv5: bool,
pub validation_timestamp: Option<Instant>,
pub ping_id: Option<Bytes>,
pub enr_request_hash: Option<H256>,
pub record: Option<NodeRecord>,
pub disposable: bool,
pub knows_us: bool,
pub unwanted: bool,
pub is_fork_id_valid: Option<bool>,
/* private fields */
}Fields§
§node: Node§is_discv4: boolWhether this contact is reachable via discv4 protocol.
is_discv5: boolWhether this contact is reachable via discv5 protocol.
validation_timestamp: Option<Instant>The timestamp when the contact was last sent a ping. If None, the contact has never been pinged.
ping_id: Option<Bytes>The identifier of the last unacknowledged ping sent to this contact, or None if no ping was sent yet or it was already acknowledged.
- discv4: H256 hash converted to Bytes
- discv5: request ID as Bytes
enr_request_hash: Option<H256>The hash of the last unacknowledged ENRRequest sent to this contact, or None if no request was sent yet or it was already acknowledged.
record: Option<NodeRecord>ENR associated with this contact, if it was provided by the peer.
disposable: boolThis contact failed to respond our Ping.
knows_us: boolSet to true after we send a successful ENRResponse to it.
unwanted: boolThis is a known-bad peer (on another network, no matching capabilities, etc)
is_fork_id_valid: Option<bool>Whether the last known fork ID is valid, None if unknown.
Implementations§
Source§impl Contact
impl Contact
pub fn was_validated(&self) -> bool
pub fn has_pending_ping(&self) -> bool
pub fn record_ping_sent(&mut self, ping_id: Bytes)
pub fn record_enr_request_sent(&mut self, request_hash: H256)
pub fn record_enr_response_received( &mut self, request_hash: H256, record: NodeRecord, )
pub fn has_pending_enr_request(&self) -> bool
Source§impl Contact
impl Contact
pub fn new(node: Node, protocol: DiscoveryProtocol) -> Self
Sourcepub fn supports_protocol(&self, protocol: DiscoveryProtocol) -> bool
pub fn supports_protocol(&self, protocol: DiscoveryProtocol) -> bool
Check if this contact supports the given protocol.
Sourcepub fn add_protocol(&mut self, protocol: DiscoveryProtocol)
pub fn add_protocol(&mut self, protocol: DiscoveryProtocol)
Mark this contact as supporting the given protocol.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Contact
impl RefUnwindSafe for Contact
impl Send for Contact
impl Sync for Contact
impl Unpin for Contact
impl UnsafeUnpin for Contact
impl UnwindSafe for Contact
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.