diff options
author | lafleur <lafleur@boum.org> | 2021-11-09 16:42:30 +0100 |
---|---|---|
committer | lafleur <lafleur@boum.org> | 2021-11-09 16:42:30 +0100 |
commit | cce17e810b1c4e277e998f0c01491fe4156a5a2f (patch) | |
tree | ffa306163074bcfd2e396020fc3b4dcf8cca6f0c /src | |
parent | 445d3e153f6673888123081f5024c3e402c370ef (diff) |
rule_match => rule_methods
Diffstat (limited to 'src')
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/rule_methods.rs (renamed from src/rule_match.rs) | 10 |
2 files changed, 7 insertions, 7 deletions
@@ -116,8 +116,8 @@ pub use rule::Rule; #[cfg(feature = "query")] pub use rule::{get_rules_cb, list_rules_for_chain}; -mod rule_match; -pub use rule_match::{iface_index, Match, Protocol, Error as MatchError}; +mod rule_methods; +pub use rule_methods::{iface_index, Protocol, RuleMethods, Error as MatchError}; pub mod set; diff --git a/src/rule_match.rs b/src/rule_methods.rs index f60f8c0..91b2c8a 100644 --- a/src/rule_match.rs +++ b/src/rule_methods.rs @@ -31,12 +31,12 @@ pub enum Protocol { UDP } -/// A Match trait over [`rustables::Rule`], to make it match some criteria, and give it a verdict. -/// Mostly adapted from [talpid-core's +/// A RuleMethods trait over [`rustables::Rule`], to make it match some criteria, and give it a +/// verdict. Mostly adapted from [talpid-core's /// firewall](https://github.com/mullvad/mullvadvpn-app/blob/d92376b4d1df9b547930c68aa9bae9640ff2a022/talpid-core/src/firewall/linux.rs). /// All methods return the rule itself, allowing them to be chained. Usage example : /// ```rust -/// use rustables::{Batch, Chain, Match, Protocol, Rule, ProtoFamily, Table, MsgType, Hook}; +/// use rustables::{Batch, Chain, Protocol, ProtoFamily, Rule, RuleMethods, Table, MsgType, Hook}; /// use std::ffi::CString; /// use std::rc::Rc; /// let table = Rc::new(Table::new(&CString::new("main_table").unwrap(), ProtoFamily::Inet)); @@ -51,7 +51,7 @@ pub enum Protocol { /// .accept(); /// batch.add(&rule, MsgType::Add); /// ``` -pub trait Match { +pub trait RuleMethods { /// Match ICMP packets. fn icmp(self) -> Self; /// Match IGMP packets. @@ -87,7 +87,7 @@ pub trait Match { } /// A trait to add helper functions to match some criterium over `rustables::Rule`. -impl Match for Rule { +impl RuleMethods for Rule { fn icmp(mut self) -> Self { self.add_expr(&nft_expr!(meta l4proto)); //self.add_expr(&nft_expr!(cmp == libc::IPPROTO_ICMPV6 as u8)); |