VanguardsConfig

Struct VanguardsConfig 

Source
pub struct VanguardsConfig {
    pub num_layer1_guards: u8,
    pub num_layer2_guards: u8,
    pub num_layer3_guards: u8,
    pub layer1_lifetime_days: u16,
    pub min_layer2_lifetime_hours: u32,
    pub max_layer2_lifetime_hours: u32,
    pub min_layer3_lifetime_hours: u32,
    pub max_layer3_lifetime_hours: u32,
}
Expand description

Vanguard-specific configuration options.

Controls the number of guards at each layer and their rotation lifetimes. These settings directly affect the security/performance tradeoff of vanguard protection.

§Guard Layers

┌─────────────────────────────────────────────────────────────────┐
│                    Vanguard Guard Layers                        │
└─────────────────────────────────────────────────────────────────┘

  Client ──▶ Layer1 ──▶ Layer2 ──▶ Layer3 ──▶ Rendezvous Point
             (Entry)    (Middle)   (Middle)

  Layer1: Entry guards (managed by Tor, configurable count)
  Layer2: First vanguard layer (longer lifetime: 1-45 days)
  Layer3: Second vanguard layer (shorter lifetime: 1-48 hours)

§Fields

FieldDefaultDescription
num_layer1_guards2Entry guards (0 = Tor default)
num_layer2_guards4Layer2 vanguard count
num_layer3_guards8Layer3 vanguard count
layer1_lifetime_days0Entry guard lifetime (0 = Tor default)
min_layer2_lifetime_hours24Minimum layer2 lifetime
max_layer2_lifetime_hours1080Maximum layer2 lifetime (45 days)
min_layer3_lifetime_hours1Minimum layer3 lifetime
max_layer3_lifetime_hours48Maximum layer3 lifetime

§Security Considerations

  • More guards = Better anonymity but more exposure to malicious relays
  • Longer lifetimes = Better protection against guard discovery but slower recovery from compromise
  • Shorter lifetimes = Faster recovery but more vulnerable to timing attacks

§Example

use vanguards_rs::VanguardsConfig;

let mut config = VanguardsConfig::default();

// Increase guard counts for higher security
config.num_layer2_guards = 6;
config.num_layer3_guards = 12;

// Extend layer2 lifetime for better protection
config.max_layer2_lifetime_hours = 2160; // 90 days

§See Also

Fields§

§num_layer1_guards: u8

Number of layer1 (entry) guards. 0 means use Tor default.

§num_layer2_guards: u8

Number of layer2 guards.

§num_layer3_guards: u8

Number of layer3 guards.

§layer1_lifetime_days: u16

Layer1 guard lifetime in days. 0 means use Tor default.

§min_layer2_lifetime_hours: u32

Minimum layer2 guard lifetime in hours.

§max_layer2_lifetime_hours: u32

Maximum layer2 guard lifetime in hours.

§min_layer3_lifetime_hours: u32

Minimum layer3 guard lifetime in hours.

§max_layer3_lifetime_hours: u32

Maximum layer3 guard lifetime in hours.

Trait Implementations§

Source§

impl Clone for VanguardsConfig

Source§

fn clone(&self) -> VanguardsConfig

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 VanguardsConfig

Source§

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

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

impl Default for VanguardsConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for VanguardsConfig

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 VanguardsConfig

Source§

fn eq(&self, other: &VanguardsConfig) -> 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 Serialize for VanguardsConfig

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 StructuralPartialEq for VanguardsConfig

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

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