Struct quilkin::filters::firewall::Rule [−][src]
Expand description
Combination of CIDR range, port range and action to take.
Fields
action: Action
source: IpNetwork
ipv4 or ipv6 CIDR address.
ports: Vec<PortRange>
Implementations
Returns true
if address
matches the provided CIDR address as well
as at least one of the port ranges in the Rule.
Examples
use quilkin::filters::firewall::{Action, PortRange};
let rule = quilkin::filters::firewall::Rule {
action: Action::Allow,
source: "192.168.75.0/24".parse().unwrap(),
ports: vec![PortRange::new(10, 100).unwrap()],
};
let ip = [192, 168, 75, 10];
assert!(rule.contains((ip, 50).into()));
assert!(rule.contains((ip, 99).into()));
assert!(rule.contains((ip, 10).into()));
assert!(!rule.contains((ip, 5).into()));
assert!(!rule.contains((ip, 1000).into()));
assert!(!rule.contains(([192, 168, 76, 10], 40).into()));
Trait Implementations
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
The name of the generated JSON Schema. Read more
Generates a JSON Schema for this type. Read more
fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the $ref
keyword. Read more
Auto Trait Implementations
impl RefUnwindSafe for Rule
impl UnwindSafe for Rule
Blanket Implementations
Mutably borrows from an owned value. Read more
Wrap the input message T
in a tonic::Request
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more