#[repr(u8)]pub enum OnionLoopClass {
KiB16 = 0,
KiB64 = 1,
KiB256 = 2,
MiB1 = 3,
MiB4 = 4,
MiB12 = 5,
}Expand description
The class b of one loop, 16 KiB … 12 MiB (#834 D6, L3): every cell of the loop, replies
included, is exactly b bytes.
A session’s caller chooses b, trading per-cell payload capacity against leakage and
admission cost:
- Leakage (#834 leakage table). A cell’s class is its byte length on the wire (
F = 0), so every hop along the loop seesb, while everything inside the cell is hidden. A small class set bounds padding overhead without exposing a byte-accurate traffic fingerprint. - Admission cost (#834 L9). Every cell of class
bcosts its receiveru(b) = b / 16 KiBadmission units (Self::units,1unit at16 KiBup to768units at12 MiB) and occupiesu(b)emission slots on a constant-rate link.
The repr(u8) discriminant is the one-byte label the header MAC binds.
Variants§
KiB16 = 0
Sixteen KiB, the default and least class: one admission unit (u = 1).
KiB64 = 1
Sixty-four KiB: four admission units (u = 4).
KiB256 = 2
256 KiB: sixteen admission units (u = 16).
MiB1 = 3
One MiB: 64 admission units (u = 64).
MiB4 = 4
Four MiB: 256 admission units (u = 256).
MiB12 = 5
Twelve MiB, the largest class: u_max = 768 admission units.
Implementations§
Source§impl OnionLoopClass
impl OnionLoopClass
Sourcepub const fn cell_bytes(self) -> usize
pub const fn cell_bytes(self) -> usize
b, the cell length in bytes.
Sourcepub const fn units(self) -> NonZeroU32
pub const fn units(self) -> NonZeroU32
u(b) = b / 16 KiB, the admission units one cell of the class costs its receiver (#834
L9): 1 + (u(b) − 1), exact since every class is a positive whole number of units that
fits u32 (asserted below).
Sourcepub fn least_for_value_bytes(value_bytes: usize) -> Option<Self>
pub fn least_for_value_bytes(value_bytes: usize) -> Option<Self>
The least class b whose padded value slot admits value_bytes (value_bytes < C₀,
#834 L3), or None above MiB12’s capacity.
Trait Implementations§
Source§impl Clone for OnionLoopClass
impl Clone for OnionLoopClass
impl Copy for OnionLoopClass
Source§impl Debug for OnionLoopClass
impl Debug for OnionLoopClass
Source§impl Default for OnionLoopClass
impl Default for OnionLoopClass
Source§impl<'de> Deserialize<'de> for OnionLoopClass
impl<'de> Deserialize<'de> for OnionLoopClass
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for OnionLoopClass
Source§impl Hash for OnionLoopClass
impl Hash for OnionLoopClass
Source§impl Ord for OnionLoopClass
impl Ord for OnionLoopClass
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for OnionLoopClass
impl PartialEq for OnionLoopClass
Source§impl PartialOrd for OnionLoopClass
impl PartialOrd for OnionLoopClass
Source§impl Serialize for OnionLoopClass
impl Serialize for OnionLoopClass
impl StructuralPartialEq for OnionLoopClass
Auto Trait Implementations§
impl Forget for OnionLoopClass
impl Freeze for OnionLoopClass
impl Move for OnionLoopClass
impl RefUnwindSafe for OnionLoopClass
impl Send for OnionLoopClass
impl Sync for OnionLoopClass
impl Unpin for OnionLoopClass
impl UnsafeUnpin for OnionLoopClass
impl UnwindSafe for OnionLoopClass
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<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
impl<T> MaybeSend for T
impl<T> MaybeSendSync for T
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.