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: usizeSize 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: usizeThreshold for the number of SURBs in the ring buffer, below which it is considered low (“SURB distress”).
Default is 500.
max_openers_per_pseudonym: usizeMaximum 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: usizeThe 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: DurationMaximum 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: DurationMaximum 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
impl Clone for SurbStoreConfig
Source§fn clone(&self) -> SurbStoreConfig
fn clone(&self) -> SurbStoreConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SurbStoreConfig
impl Debug for SurbStoreConfig
Source§impl Default for SurbStoreConfig
impl Default for SurbStoreConfig
Source§fn default() -> Self
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
impl<'de> Deserialize<'de> for SurbStoreConfig
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>,
Source§impl PartialEq for SurbStoreConfig
impl PartialEq for SurbStoreConfig
Source§impl PartialOrd for SurbStoreConfig
impl PartialOrd for SurbStoreConfig
Source§impl Serialize for SurbStoreConfig
impl Serialize for SurbStoreConfig
Source§impl<'v_a> ValidateArgs<'v_a> for SurbStoreConfig
impl<'v_a> ValidateArgs<'v_a> for SurbStoreConfig
impl Copy for SurbStoreConfig
impl Eq for SurbStoreConfig
impl StructuralPartialEq for SurbStoreConfig
Auto Trait Implementations§
impl Freeze for SurbStoreConfig
impl RefUnwindSafe for SurbStoreConfig
impl Send for SurbStoreConfig
impl Sync for SurbStoreConfig
impl Unpin for SurbStoreConfig
impl UnwindSafe for SurbStoreConfig
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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