pub struct FirewallRule {
pub id: u64,
pub priority: u32,
pub criteria: MatchCriteria,
pub action: RuleAction,
pub packets: u64,
pub bytes: u64,
pub enabled: bool,
pub comment: String,
}Expand description
A single firewall rule with match criteria, action, and counters
Fields§
§id: u64Unique rule identifier
priority: u32Priority (lower = evaluated first within a chain)
criteria: MatchCriteriaMatch criteria
action: RuleActionAction to take on match
packets: u64Packet counter
bytes: u64Byte counter
enabled: boolWhether this rule is active
comment: StringOptional comment/description
Implementations§
Source§impl FirewallRule
impl FirewallRule
Sourcepub fn new(id: u64, criteria: MatchCriteria, action: RuleAction) -> Self
pub fn new(id: u64, criteria: MatchCriteria, action: RuleAction) -> Self
Create a new rule with the given criteria and action
Sourcepub fn with_priority(self, priority: u32) -> Self
pub fn with_priority(self, priority: u32) -> Self
Set the rule priority
Sourcepub fn with_comment(self, comment: &str) -> Self
pub fn with_comment(self, comment: &str) -> Self
Set the rule comment
Sourcepub fn matches_packet(&self, meta: &PacketMetadata) -> bool
pub fn matches_packet(&self, meta: &PacketMetadata) -> bool
Check if this rule matches the given packet metadata
Sourcepub fn reset_counters(&mut self)
pub fn reset_counters(&mut self)
Reset packet/byte counters
Trait Implementations§
Source§impl Clone for FirewallRule
impl Clone for FirewallRule
Source§fn clone(&self) -> FirewallRule
fn clone(&self) -> FirewallRule
Returns a duplicate of the value. Read more
1.0.0§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 FirewallRule
impl RefUnwindSafe for FirewallRule
impl Send for FirewallRule
impl Sync for FirewallRule
impl Unpin for FirewallRule
impl UnwindSafe for FirewallRule
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)