pub struct Layer1Guards {
pub guards: HashMap<String, Layer1Stats>,
pub num_layer1: u8,
}Expand description
Layer 1 guard tracking.
Tracks connections and usage for entry guards. Monitors for anomalies such as too many or too few guard connections, or unexpected guard usage.
§Example
use vanguards_rs::pathverify::Layer1Guards;
let mut guards = Layer1Guards::new(2);
// Track a guard connection
guards.add_conn("AABBCCDD00112233445566778899AABBCCDDEEFF");
assert!(guards.contains("AABBCCDD00112233445566778899AABBCCDDEEFF"));
// Track guard usage
guards.add_use_count("AABBCCDD00112233445566778899AABBCCDDEEFF");§See Also
Layer1Stats- Statistics for individual guardsPathVerify- Uses this for layer 1 tracking
Fields§
§guards: HashMap<String, Layer1Stats>Guard statistics by fingerprint.
num_layer1: u8Expected number of layer 1 guards.
Implementations§
Source§impl Layer1Guards
impl Layer1Guards
Sourcepub fn check_conn_counts(&self) -> i32
pub fn check_conn_counts(&self) -> i32
Checks connection counts and logs warnings.
Returns -1 when fewer than expected, 0 when correct, +1 when too many.
Sourcepub fn add_use_count(&mut self, guard_fp: &str)
pub fn add_use_count(&mut self, guard_fp: &str)
Adds a use count for a guard.
Sourcepub fn check_use_counts(&self) -> i32
pub fn check_use_counts(&self) -> i32
Checks use counts and logs warnings.
Returns -1 when fewer than expected, 0 when correct, +1 when too many.
Trait Implementations§
Source§impl Clone for Layer1Guards
impl Clone for Layer1Guards
Source§fn clone(&self) -> Layer1Guards
fn clone(&self) -> Layer1Guards
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 moreAuto Trait Implementations§
impl Freeze for Layer1Guards
impl RefUnwindSafe for Layer1Guards
impl Send for Layer1Guards
impl Sync for Layer1Guards
impl Unpin for Layer1Guards
impl UnwindSafe for Layer1Guards
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