pub struct Filter {
pub includes: Option<Includes>,
pub excludes: Option<Excludes>,
pub schemes: HashSet<String>,
pub exclude_private_ips: bool,
pub exclude_link_local_ips: bool,
pub exclude_loopback_ips: bool,
pub include_mail: bool,
}
Expand description
A generic URI filter Used to decide if a given URI should be checked or skipped
Fields§
§includes: Option<Includes>
URIs explicitly included for checking. This takes precedence over excludes
excludes: Option<Excludes>
URIs excluded from checking
schemes: HashSet<String>
Only check URIs with the given schemes (e.g. https
and http
)
exclude_private_ips: bool
Example: 192.168.0.1
exclude_link_local_ips: bool
Example: 169.254.0.0
exclude_loopback_ips: bool
For IPv4: 127.0.0.1/8
For IPv6: ::1/128
include_mail: bool
Example: octocat@github.com
Implementations§
Source§impl Filter
impl Filter
Sourcepub fn is_mail_excluded(&self, uri: &Uri) -> bool
pub fn is_mail_excluded(&self, uri: &Uri) -> bool
Whether e-mails aren’t checked (which is the default)
Sourcepub fn is_ip_excluded(&self, uri: &Uri) -> bool
pub fn is_ip_excluded(&self, uri: &Uri) -> bool
Whether the IP address is excluded from checking
Sourcepub fn is_host_excluded(&self, uri: &Uri) -> bool
pub fn is_host_excluded(&self, uri: &Uri) -> bool
Whether the host is excluded from checking
Sourcepub fn is_scheme_excluded(&self, uri: &Uri) -> bool
pub fn is_scheme_excluded(&self, uri: &Uri) -> bool
Whether the scheme of the given URI is excluded
Sourcepub fn is_excluded(&self, uri: &Uri) -> bool
pub fn is_excluded(&self, uri: &Uri) -> bool
Determine whether a given Uri
should be excluded.
§Details
- If any of the following conditions are met, the URI is excluded:
- If it’s a mail address and it’s not configured to include mail addresses.
- If the IP address belongs to a type that is configured to exclude.
- If the host belongs to a type that is configured to exclude.
- If the scheme of URI is not the allowed scheme.
- Decide whether the URI is presumably included or explicitly included:
- When both excludes and includes rules are empty, it’s presumably included unless it’s a known false positive.
- When the includes rules matches the URI, it’s explicitly included.
- When it’s a known false positive pattern, it’s explicitly excluded.
- Decide whether the URI is presumably excluded or explicitly excluded:
- When excludes rules is empty, but includes rules doesn’t match the URI, it’s presumably excluded.
- When the excludes rules matches the URI, it’s explicitly excluded.
- When the excludes rules matches the URI, it’s explicitly excluded.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Filter
impl RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnwindSafe for Filter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more