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
| Field | Default | Description |
|---|---|---|
num_layer1_guards | 2 | Entry guards (0 = Tor default) |
num_layer2_guards | 4 | Layer2 vanguard count |
num_layer3_guards | 8 | Layer3 vanguard count |
layer1_lifetime_days | 0 | Entry guard lifetime (0 = Tor default) |
min_layer2_lifetime_hours | 24 | Minimum layer2 lifetime |
max_layer2_lifetime_hours | 1080 | Maximum layer2 lifetime (45 days) |
min_layer3_lifetime_hours | 1 | Minimum layer3 lifetime |
max_layer3_lifetime_hours | 48 | Maximum 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
Config- Main configuration structVanguardState- Runtime guard state
Fields§
§num_layer1_guards: u8Number of layer1 (entry) guards. 0 means use Tor default.
num_layer2_guards: u8Number of layer2 guards.
num_layer3_guards: u8Number of layer3 guards.
layer1_lifetime_days: u16Layer1 guard lifetime in days. 0 means use Tor default.
min_layer2_lifetime_hours: u32Minimum layer2 guard lifetime in hours.
max_layer2_lifetime_hours: u32Maximum layer2 guard lifetime in hours.
min_layer3_lifetime_hours: u32Minimum layer3 guard lifetime in hours.
max_layer3_lifetime_hours: u32Maximum layer3 guard lifetime in hours.
Trait Implementations§
Source§impl Clone for VanguardsConfig
impl Clone for VanguardsConfig
Source§fn clone(&self) -> VanguardsConfig
fn clone(&self) -> VanguardsConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VanguardsConfig
impl Debug for VanguardsConfig
Source§impl Default for VanguardsConfig
impl Default for VanguardsConfig
Source§impl<'de> Deserialize<'de> for VanguardsConfig
impl<'de> Deserialize<'de> for VanguardsConfig
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for VanguardsConfig
impl PartialEq for VanguardsConfig
Source§impl Serialize for VanguardsConfig
impl Serialize for VanguardsConfig
impl StructuralPartialEq for VanguardsConfig
Auto Trait Implementations§
impl Freeze for VanguardsConfig
impl RefUnwindSafe for VanguardsConfig
impl Send for VanguardsConfig
impl Sync for VanguardsConfig
impl Unpin for VanguardsConfig
impl UnwindSafe for VanguardsConfig
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
Mutably borrows from an owned value. Read more