pub struct IpFilter { /* private fields */ }Expand description
Middleware that filters requests by client IP address.
Constructed via IpFilter::allow or IpFilter::deny. Each entry
may be an exact address ("1.2.3.4", "2001:db8::1") or a CIDR range
("10.0.0.0/8", "2001:db8::/32"). Malformed entries are skipped; check
them with is_valid_entry (rws --check does).
Implementations§
Source§impl IpFilter
impl IpFilter
Trait Implementations§
Source§impl Middleware for IpFilter
impl Middleware for IpFilter
Source§fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
fn runs_inline(&self, _request: &Request, _connection: &ConnectionInfo) -> bool
In-memory only: safe on the event loop.
fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Source§fn is_passthrough(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn is_passthrough( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
true when handle would do nothing for request but call next
(e.g. a rate limit that isn’t configured). A WithMiddleware stack
offers the inner application’s execute_async only if every layer
passes the request through. Default false.Auto Trait Implementations§
impl Freeze for IpFilter
impl RefUnwindSafe for IpFilter
impl Send for IpFilter
impl Sync for IpFilter
impl Unpin for IpFilter
impl UnsafeUnpin 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