Skip to main content

AdversaryModel

Struct AdversaryModel 

Source
pub struct AdversaryModel {
    pub adversary_type: AdversaryType,
    pub capabilities: AdversaryCapabilities,
    pub compromised_nodes: HashSet<[u8; 32]>,
    pub observed_flows: Vec<ObservedFlow>,
}
Expand description

Simulated adversary acting on network traffic.

Fields§

§adversary_type: AdversaryType§capabilities: AdversaryCapabilities§compromised_nodes: HashSet<[u8; 32]>

Set of compromised node IDs.

§observed_flows: Vec<ObservedFlow>

Observed traffic flows.

Implementations§

Source§

impl AdversaryModel

Source

pub fn new(adversary_type: AdversaryType) -> Self

Source

pub fn compromise_node(&mut self, node_id: [u8; 32])

Compromise a specific relay node.

Source

pub fn is_compromised(&self, node_id: &[u8; 32]) -> bool

Check if a node is compromised.

Source

pub fn observe_flow(&mut self, flow: ObservedFlow)

Observe a traffic flow.

Source

pub fn correlate_flows(&self, a: &ObservedFlow, b: &ObservedFlow) -> f64

Attempt to correlate two flows (by timing patterns).

Source

pub fn circuit_compromise_probability(&self, path_length: usize) -> f64

Evaluate circuit anonymity: probability of deanonymization.

Source

pub fn observed_count(&self) -> usize

Total observed flow count.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V