pub struct LookupHints { /* private fields */ }Expand description
Add-only accumulator of out-of-band lookup hints (review rule R7).
Hints supplement — never replace — the watermark-anchored BEP5 scan. This
type is the structural home for the BEP44 deterministic-mailbox channel
when it ships (see V1_MAILBOX_HINT_CHANNEL); today it is fed by any
out-of-band source (PDS record, relay bridge, configuration).
Provably add-only. The API exposes LookupHints::add_rendezvous and
LookupHints::add_peer and nothing that removes, replaces, or clears
entries. MainlineLocator::providers_with_hints always performs the
scan at the canonical rendezvous key and then unions these hints in — a
hint can enlarge the candidate set, never prune it or skip the scan (A14).
Bounded (DoS). Hints often originate from untrusted sources, so the
accumulator caps both rendezvous buckets (MAX_HINTED_RENDEZVOUS) and
peers (MAX_HINTED_PEERS), dedupes by value, and the locator caps total
returned candidates (MAX_LOCATOR_RESULTS). An attacker who feeds a huge
hint set can do no more than a fixed amount of extra DHT/network work.
Implementations§
Source§impl LookupHints
impl LookupHints
Sourcepub fn add_rendezvous(&mut self, key: RendezvousKey) -> bool
pub fn add_rendezvous(&mut self, key: RendezvousKey) -> bool
Add an additional rendezvous bucket to scan, beyond the canonical key. Add-only (R7): there is no corresponding remove.
Returns false (without storing) if key is a duplicate or the
MAX_HINTED_RENDEZVOUS cap is reached — bounding DHT work from
untrusted hint sources. The set otherwise never shrinks.
Sourcepub fn add_peer(&mut self, peer: PeerContact) -> bool
pub fn add_peer(&mut self, peer: PeerContact) -> bool
Add a candidate peer discovered out-of-band (e.g. from a PDS record). Add-only (R7): there is no corresponding remove.
Returns false (without storing) if peer is a duplicate or the
MAX_HINTED_PEERS cap is reached — bounding downstream fetch work.
Sourcepub fn extra_rendezvous(&self) -> &[RendezvousKey]
pub fn extra_rendezvous(&self) -> &[RendezvousKey]
Additional rendezvous buckets to scan (in insertion order, deduped).
Sourcepub fn extra_peers(&self) -> &[PeerContact]
pub fn extra_peers(&self) -> &[PeerContact]
Additional candidate peers to union in (in insertion order, deduped).
Trait Implementations§
Source§impl Clone for LookupHints
impl Clone for LookupHints
Source§fn clone(&self) -> LookupHints
fn clone(&self) -> LookupHints
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LookupHints
impl Debug for LookupHints
Source§impl Default for LookupHints
impl Default for LookupHints
Source§fn default() -> LookupHints
fn default() -> LookupHints
Auto Trait Implementations§
impl Freeze for LookupHints
impl RefUnwindSafe for LookupHints
impl Send for LookupHints
impl Sync for LookupHints
impl Unpin for LookupHints
impl UnsafeUnpin for LookupHints
impl UnwindSafe for LookupHints
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more