pub struct RuleBuilder { /* private fields */ }Expand description
A builder struct for Rules. This should generally be constructed with Rule::builder, or
a shortcut such as Rule::source_cidr.
Implementations§
Source§impl RuleBuilder
impl RuleBuilder
Sourcepub fn action(self, action: Action) -> Self
pub fn action(self, action: Action) -> Self
Sets the rule’s Action
The action applies to all packets matching the rule, unless overridden by successive rules.
Sourcepub fn source_cidr(self, cidr_range: impl IntoIpNet) -> Self
pub fn source_cidr(self, cidr_range: impl IntoIpNet) -> Self
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(self, port: impl IntoPortRange) -> Self
pub fn source_port(self, port: impl IntoPortRange) -> Self
Sets the source port
Accepts a u16 or range
Sourcepub fn destination_cidr(self, cidr_range: impl IntoIpNet) -> Self
pub fn destination_cidr(self, cidr_range: impl IntoIpNet) -> Self
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(self, port: impl IntoPortRange) -> Self
pub fn destination_port(self, port: impl IntoPortRange) -> Self
Sets the destination port
Accepts a u16 or range
Trait Implementations§
Source§impl Default for RuleBuilder
impl Default for RuleBuilder
Source§fn default() -> RuleBuilder
fn default() -> RuleBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RuleBuilder
impl RefUnwindSafe for RuleBuilder
impl Send for RuleBuilder
impl Sync for RuleBuilder
impl Unpin for RuleBuilder
impl UnsafeUnpin for RuleBuilder
impl UnwindSafe for RuleBuilder
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