pub struct PortSummaryThresholds {
pub v4: u128,
pub v6: u128,
}Expand description
Thresholds for deciding whether a port counts as open, for a summary
Each value is the maximum number of individual addresses that may be blocked before the port is considered closed.
The Default implementation, and PortSummaryThresholds::DEFAULT,
provide the thresholds currently specified in torspec.
We provide this as a controllable parameter so that the summariser is a pure function that doesn’t embed these tuneables. Then if the spec changes, the directory authority consensus calculator can provide the appropriate thresholds depending on the consensus method.
Fields§
§v4: u128IPv4
Currently, the spec says
no more than 2^25 IPv4 addresses (two /8’s worth, or one /7’s worth)
v6: u128IPv6
Currently, the spec says
no more than 2^112 IPv6 addresses (one /16’s worth)
Implementations§
Source§impl PortSummaryThresholds
impl PortSummaryThresholds
Sourcepub const DEFAULT: PortSummaryThresholds
pub const DEFAULT: PortSummaryThresholds
Default value, from the Tor Specifications
Sourcepub const fn from_prefix_lengths(
v4_prefix_len: u8,
v6_prefix_len: u8,
) -> PortSummaryThresholds
pub const fn from_prefix_lengths( v4_prefix_len: u8, v6_prefix_len: u8, ) -> PortSummaryThresholds
PortSummaryThresholds from prefix lengths
Returns a PortSummaryThresholds whose thresholds are
“one /v4’s worth” for IPv4
and
“one /v6’s worth” for IPv6.
Trait Implementations§
Source§impl Clone for PortSummaryThresholds
impl Clone for PortSummaryThresholds
Source§impl Debug for PortSummaryThresholds
impl Debug for PortSummaryThresholds
Source§impl Default for PortSummaryThresholds
impl Default for PortSummaryThresholds
impl Eq for PortSummaryThresholds
Source§impl Hash for PortSummaryThresholds
impl Hash for PortSummaryThresholds
Source§impl PartialEq for PortSummaryThresholds
impl PartialEq for PortSummaryThresholds
impl StructuralPartialEq for PortSummaryThresholds
Auto Trait Implementations§
impl Freeze for PortSummaryThresholds
impl RefUnwindSafe for PortSummaryThresholds
impl Send for PortSummaryThresholds
impl Sync for PortSummaryThresholds
impl Unpin for PortSummaryThresholds
impl UnsafeUnpin for PortSummaryThresholds
impl UnwindSafe for PortSummaryThresholds
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> 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more