pub struct Machine {
pub allowed_padding_packets: u64,
pub max_padding_frac: f64,
pub allowed_blocked_microsec: u64,
pub max_blocking_frac: f64,
pub states: Vec<State>,
}
Expand description
A probabilistic state machine (Rabin automaton) consisting of one or more
State
that determine when to inject and/or block outgoing traffic.
Fields§
§allowed_padding_packets: u64
The number of padding packets the machine is allowed to generate as actions before other limits apply.
max_padding_frac: f64
The maximum fraction of padding packets to allow as actions.
allowed_blocked_microsec: u64
The number of microseconds of blocking a machine is allowed to generate as actions before other limits apply.
max_blocking_frac: f64
The maximum fraction of blocking (microseconds) to allow as actions.
states: Vec<State>
The states that make up the machine.
Implementations§
Source§impl Machine
impl Machine
Sourcepub fn new(
allowed_padding_packets: u64,
max_padding_frac: f64,
allowed_blocked_microsec: u64,
max_blocking_frac: f64,
states: Vec<State>,
) -> Result<Self, Error>
pub fn new( allowed_padding_packets: u64, max_padding_frac: f64, allowed_blocked_microsec: u64, max_blocking_frac: f64, states: Vec<State>, ) -> Result<Self, Error>
Create a new Machine
with the given limits and states. Returns an
error if the machine or any of its states are invalid.
Sourcepub fn name(&self) -> String
pub fn name(&self) -> String
Get a unique and deterministic string that represents the machine. The string is 32 characters long, hex-encoded.
pub fn serialize(&self) -> String
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Machine
impl<'de> Deserialize<'de> for Machine
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
Auto Trait Implementations§
impl Freeze for Machine
impl RefUnwindSafe for Machine
impl Send for Machine
impl Sync for Machine
impl Unpin for Machine
impl UnwindSafe for Machine
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