pub struct IpFilter {
pub ipv4_addresses: Vec<Ipv4Addr>,
pub ipv6_addresses: Vec<Ipv6Addr>,
pub check_source: bool,
pub check_destination: bool,
}Expand description
IP address filter configuration
Filters packets based on specific IPv4 or IPv6 addresses.
§Examples
use huginn_net_http::IpFilter;
let filter = IpFilter::new()
.allow("8.8.8.8")
.unwrap()
.allow("2001:4860:4860::8888")
.unwrap();Fields§
§ipv4_addresses: Vec<Ipv4Addr>IPv4 addresses to match
ipv6_addresses: Vec<Ipv6Addr>IPv6 addresses to match
check_source: boolCheck source, destination, or both?
check_destination: boolImplementations§
Source§impl IpFilter
impl IpFilter
Sourcepub fn source_only(self) -> Self
pub fn source_only(self) -> Self
Only check source addresses
By default, both source and destination are checked.
Sourcepub fn destination_only(self) -> Self
pub fn destination_only(self) -> Self
Only check destination addresses
By default, both source and destination are checked.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IpFilter
impl RefUnwindSafe for IpFilter
impl Send for IpFilter
impl Sync for IpFilter
impl Unpin for IpFilter
impl UnwindSafe for IpFilter
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