Struct lychee_lib::filter::Filter
source · [−]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 exclude_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
exclude_mail: bool
Example: octocat@github.com
Implementations
sourceimpl 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
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 configured to ignore 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 RefUnwindSafe for Filter
impl Send for Filter
impl Sync for Filter
impl Unpin for Filter
impl UnwindSafe for Filter
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more