pub struct BandguardsConfig {
pub circ_max_megabytes: u64,
pub circ_max_age_hours: u32,
pub circ_max_hsdesc_kilobytes: u32,
pub circ_max_serv_intro_kilobytes: u32,
pub circ_max_disconnected_secs: u32,
pub conn_max_disconnected_secs: u32,
}Expand description
Bandwidth monitoring configuration options.
Controls circuit bandwidth limits and disconnection warnings. These settings help detect bandwidth-based side-channel attacks that attempt to identify hidden services through traffic analysis.
§Attack Detection
Bandguards monitors for several attack patterns:
┌─────────────────────────────────────────────────────────────────┐
│ Bandwidth Attack Detection │
└─────────────────────────────────────────────────────────────────┘
1. Circuit Size Attack
├── Monitor total bytes per circuit
└── Alert/close if exceeds circ_max_megabytes
2. Circuit Age Attack
├── Track circuit creation time
└── Alert/close if exceeds circ_max_age_hours
3. HSDIR Descriptor Attack
├── Monitor HSDIR circuit bandwidth
└── Alert if exceeds circ_max_hsdesc_kilobytes
4. Connectivity Monitoring
├── Track disconnection duration
└── Warn if exceeds threshold§Fields
| Field | Default | Description |
|---|---|---|
circ_max_megabytes | 0 | Max circuit size in MB (0 = disabled) |
circ_max_age_hours | 24 | Max circuit age in hours |
circ_max_hsdesc_kilobytes | 30 | Max HSDIR circuit size in KB |
circ_max_serv_intro_kilobytes | 0 | Max intro circuit size (0 = disabled) |
circ_max_disconnected_secs | 30 | Warn after N seconds disconnected |
conn_max_disconnected_secs | 15 | Warn after N seconds with no connections |
§Example
use vanguards_rs::BandguardsConfig;
let mut config = BandguardsConfig::default();
// Enable circuit size limiting
config.circ_max_megabytes = 100;
// Reduce circuit age for higher security
config.circ_max_age_hours = 12;§See Also
Config- Main configuration structBandwidthStats- Runtime bandwidth statistics
Fields§
§circ_max_megabytes: u64Maximum circuit size in megabytes. 0 disables this check.
circ_max_age_hours: u32Maximum circuit age in hours.
circ_max_hsdesc_kilobytes: u32Maximum HSDIR circuit size in kilobytes.
circ_max_serv_intro_kilobytes: u32Maximum service intro circuit size in kilobytes. 0 disables.
circ_max_disconnected_secs: u32Warn after this many seconds disconnected from circuits.
conn_max_disconnected_secs: u32Warn after this many seconds with no connections.
Trait Implementations§
Source§impl Clone for BandguardsConfig
impl Clone for BandguardsConfig
Source§fn clone(&self) -> BandguardsConfig
fn clone(&self) -> BandguardsConfig
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 BandguardsConfig
impl Debug for BandguardsConfig
Source§impl Default for BandguardsConfig
impl Default for BandguardsConfig
Source§impl<'de> Deserialize<'de> for BandguardsConfig
impl<'de> Deserialize<'de> for BandguardsConfig
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 BandguardsConfig
impl PartialEq for BandguardsConfig
Source§impl Serialize for BandguardsConfig
impl Serialize for BandguardsConfig
impl StructuralPartialEq for BandguardsConfig
Auto Trait Implementations§
impl Freeze for BandguardsConfig
impl RefUnwindSafe for BandguardsConfig
impl Send for BandguardsConfig
impl Sync for BandguardsConfig
impl Unpin for BandguardsConfig
impl UnwindSafe for BandguardsConfig
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