pub struct Rule { /* private fields */ }Expand description
A rule for controlling packet routing. Rules can be build with RuleBuilder and require at
least one filter constraint, and an action.
Implementations§
Source§impl Rule
impl Rule
Sourcepub fn builder() -> RuleBuilder
pub fn builder() -> RuleBuilder
Creates a RuleBuilder
Sourcepub fn action(action: Action) -> RuleBuilder
pub fn action(action: Action) -> RuleBuilder
Creates a RuleBuilder and sets the rule’s Action
The action applies to all packets matching the rule, unless overridden by successive rules.
Sourcepub fn protocol(protocol: Protocol) -> RuleBuilder
pub fn protocol(protocol: Protocol) -> RuleBuilder
Creates a RuleBuilder and sets the rule’s Protocol
Sourcepub fn source_cidr(cidr_range: impl IntoIpNet) -> RuleBuilder
pub fn source_cidr(cidr_range: impl IntoIpNet) -> RuleBuilder
Creates a RuleBuilder and sets the source CIDR.
Accepts any IP address or CIDR notation:
"127.0.0.1": matches a single IP"10.0.0.0/24": matches a CIDR
This additionally accepts std::net::IpAddr, std::net::Ipv4Addr,
std::net::Ipv6Addr, ipnet::IpNet, ipnet::Ipv4Net, and ipnet::Ipv6Net.
Sourcepub fn source_port(port: impl IntoPortRange) -> RuleBuilder
pub fn source_port(port: impl IntoPortRange) -> RuleBuilder
Creates a RuleBuilder and sets the source port
Accepts a u16 or range
Sourcepub fn destination_cidr(cidr_range: impl IntoIpNet) -> RuleBuilder
pub fn destination_cidr(cidr_range: impl IntoIpNet) -> RuleBuilder
Creates a RuleBuilder and sets the destination CIDR.
Accepts any IP address or CIDR notation:
"127.0.0.1": matches a single IP"10.0.0.0/24": matches a CIDR
This additionally accepts std::net::IpAddr, std::net::Ipv4Addr,
std::net::Ipv6Addr, ipnet::IpNet, ipnet::Ipv4Net, and ipnet::Ipv6Net.
Sourcepub fn destination_port(port: impl IntoPortRange) -> RuleBuilder
pub fn destination_port(port: impl IntoPortRange) -> RuleBuilder
Creates a RuleBuilder and sets the destination port
Accepts a u16 or range