pub struct PeerHTLConfig {
pub at_max_sample: f64,
pub at_min_sample: f64,
}Expand description
Per-peer HTL configuration (Freenet-style probabilistic decrement) Generated once per peer connection, stays fixed for connection lifetime
Fields§
§at_max_sample: f64Random sample used to decide decrement at max HTL.
at_min_sample: f64Random sample used to decide decrement at min HTL.
Implementations§
Source§impl PeerHTLConfig
impl PeerHTLConfig
Sourcepub fn random() -> PeerHTLConfig
pub fn random() -> PeerHTLConfig
Generate random HTL config for a new peer connection
Sourcepub fn from_samples(at_max_sample: f64, at_min_sample: f64) -> PeerHTLConfig
pub fn from_samples(at_max_sample: f64, at_min_sample: f64) -> PeerHTLConfig
Construct config from explicit random samples.
Sourcepub fn from_flags(
decrement_at_max: bool,
decrement_at_min: bool,
) -> PeerHTLConfig
pub fn from_flags( decrement_at_max: bool, decrement_at_min: bool, ) -> PeerHTLConfig
Construct config from explicit decrement choices.
Sourcepub fn decrement(&self, htl: u8) -> u8
pub fn decrement(&self, htl: u8) -> u8
Decrement HTL using this peer’s config (Freenet-style probabilistic) Called when SENDING to a peer, not on receive
Sourcepub fn decrement_with_policy(&self, htl: u8, policy: &HtlPolicy) -> u8
pub fn decrement_with_policy(&self, htl: u8, policy: &HtlPolicy) -> u8
Decrement HTL using the provided traffic policy.
Trait Implementations§
Source§impl Clone for PeerHTLConfig
impl Clone for PeerHTLConfig
Source§fn clone(&self) -> PeerHTLConfig
fn clone(&self) -> PeerHTLConfig
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 PeerHTLConfig
impl Debug for PeerHTLConfig
Source§impl Default for PeerHTLConfig
impl Default for PeerHTLConfig
Source§fn default() -> PeerHTLConfig
fn default() -> PeerHTLConfig
Returns the “default value” for a type. Read more
impl Copy for PeerHTLConfig
Auto Trait Implementations§
impl Freeze for PeerHTLConfig
impl RefUnwindSafe for PeerHTLConfig
impl Send for PeerHTLConfig
impl Sync for PeerHTLConfig
impl Unpin for PeerHTLConfig
impl UnsafeUnpin for PeerHTLConfig
impl UnwindSafe for PeerHTLConfig
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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§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>
Converts
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>
Converts
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