SurbStoreConfig

Struct SurbStoreConfig 

Source
pub struct SurbStoreConfig {
    pub rb_capacity: usize,
    pub distress_threshold: usize,
    pub max_openers_per_pseudonym: usize,
    pub max_pseudonyms: usize,
    pub pseudonyms_lifetime: Duration,
    pub reply_opener_lifetime: Duration,
}
Expand description

Configuration for the SURB cache.

The configuration options affect both the sending side (SURB creator) and the replying side (SURB consumer).

In the classical scenario (Entry - Relay 1 -... - Exit), the sending side is the Entry and the replying side is the Exit.

Fields§

§rb_capacity: usize

Size of the SURB ring buffer per pseudonym.

Affects only the replying side.

This indicates how many SURBs can be at most held to be used to send a reply back to the sending side.

Default is 15 000.

§distress_threshold: usize

Threshold for the number of SURBs in the ring buffer, below which it is considered low (“SURB distress”).

Default is 500.

§max_openers_per_pseudonym: usize

Maximum number of reply openers (SURB counterparts) per pseudonym.

Affects only the sending side when decrypting a received reply.

This mostly affects Sessions, as they use a fixed pseudonym. It reflects how many reply openers the initiator-side of a Session can hold, until the oldest ones are dropped. If the other party uses a SURB corresponding to a dropped reply opener, the reply message will be undecryptable by the initiator-side.

Default is 100 000.

§max_pseudonyms: usize

The maximum number of distinct pseudonyms for which we hold a SURB ringbuffer.

Affects only the replying side.

For each pseudonym, there is a ring-buffer with capacity rb_capacity.

Default is 10 000.

§pseudonyms_lifetime: Duration

Maximum lifetime of ring-buffer for each pseudonym.

§Effects on sending side

This is the period for which we hold all reply openers for a pseudonym. If no more messages carrying SURBs are sent during this period, the entire stash of reply openers is dropped. Preventing receiving any more replies for that pseudonym.

§Effects on replying side

If a pseudonym has not received any SURBs for this period, the entire ring buffer with rb_capacity (= all SURBs for this pseudonym) is dropped. Preventing from sending any more replies for that pseudonym.

Default is 600 seconds.

§reply_opener_lifetime: Duration

Maximum lifetime of a reply opener.

Affects only the sending side.

A reply opener is distinguished using [HoprSurbId] and a pseudonym it belongs to. If a reply opener is not used to decrypt the received packet within this period, it is dropped. If the replying side uses the corresponding SURB to send a reply, it won’t be possible to decrypt it when received.

Default is 3600 seconds.

Trait Implementations§

Source§

impl Clone for SurbStoreConfig

Source§

fn clone(&self) -> SurbStoreConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SurbStoreConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SurbStoreConfig

Source§

fn default() -> Self

Return SurbStoreConfig { rb_capacity: default_rb_capacity(), distress_threshold: default_distress_threshold(), max_openers_per_pseudonym: default_max_openers_per_pseudonym(), max_pseudonyms: default_max_pseudonyms(), pseudonyms_lifetime: default_pseudonyms_lifetime(), reply_opener_lifetime: default_reply_opener_lifetime() }

Source§

impl<'de> Deserialize<'de> for SurbStoreConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SurbStoreConfig

Source§

fn eq(&self, other: &SurbStoreConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for SurbStoreConfig

Source§

fn partial_cmp(&self, other: &SurbStoreConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for SurbStoreConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Validate for SurbStoreConfig

Source§

fn validate(&self) -> Result<(), ValidationErrors>

Source§

impl<'v_a> ValidateArgs<'v_a> for SurbStoreConfig

Source§

type Args = ()

Source§

fn validate_with_args(&self, args: Self::Args) -> Result<(), ValidationErrors>

Source§

impl Copy for SurbStoreConfig

Source§

impl Eq for SurbStoreConfig

Source§

impl StructuralPartialEq for SurbStoreConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<'de, T> BorrowedRpcObject<'de> for T
where T: RpcBorrow<'de> + RpcSend,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<'de, T> RpcBorrow<'de> for T
where T: Deserialize<'de> + Debug + Send + Sync + Unpin,

§

impl<T> RpcObject for T
where T: RpcSend + RpcRecv,

§

impl<T> RpcRecv for T
where T: DeserializeOwned + Debug + Send + Sync + Unpin + 'static,

§

impl<T> RpcSend for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,