pub struct CensorshipSimulator { /* private fields */ }Expand description
Censorship simulator with configurable rule sets.
Implementations§
Source§impl CensorshipSimulator
impl CensorshipSimulator
pub fn new() -> Self
Sourcepub fn with_standard_rules() -> Self
pub fn with_standard_rules() -> Self
Create a simulator with common censorship rules.
Sourcepub fn add_rule(&mut self, rule: BlockingRule)
pub fn add_rule(&mut self, rule: BlockingRule)
Add a blocking rule.
Sourcepub fn clear_rules(&mut self)
pub fn clear_rules(&mut self)
Remove all rules.
Sourcepub fn check_packet(&mut self, packet: &SimulatedPacket) -> CensorResult
pub fn check_packet(&mut self, packet: &SimulatedPacket) -> CensorResult
Check a packet against all active rules.
Sourcepub fn batch_test(
&mut self,
packets: &[SimulatedPacket],
) -> (usize, usize, usize)
pub fn batch_test( &mut self, packets: &[SimulatedPacket], ) -> (usize, usize, usize)
Batch test: returns (allowed, blocked, throttled) counts.
Sourcepub fn stats(&self) -> CensorStats
pub fn stats(&self) -> CensorStats
Get statistics.
Sourcepub fn rule_count(&self) -> usize
pub fn rule_count(&self) -> usize
Number of rules.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CensorshipSimulator
impl RefUnwindSafe for CensorshipSimulator
impl Send for CensorshipSimulator
impl Sync for CensorshipSimulator
impl Unpin for CensorshipSimulator
impl UnsafeUnpin for CensorshipSimulator
impl UnwindSafe for CensorshipSimulator
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