pub struct BlocklistLayer;Expand description
Middleware that checks each request’s client IP against global().
Blocked IPs receive 403 Forbidden. All other requests pass through
to the next layer.
Trait Implementations§
Source§impl Middleware for BlocklistLayer
impl Middleware for BlocklistLayer
Source§fn accepts_streamed_body(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn accepts_streamed_body( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
Headers only: a streamed body passes through untouched.
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.
Source§fn is_passthrough(
&self,
_request: &Request,
connection: &ConnectionInfo,
) -> bool
fn is_passthrough( &self, _request: &Request, connection: &ConnectionInfo, ) -> bool
Clients that aren’t blocked pass straight through, so config proxy routes keep the non-blocking forwarder (since 18.20.1, when the binary added this layer to proxy mode); an empty list is one atomic load.
fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Source§fn answers_streamed_body(
&self,
_request: &Request,
_connection: &ConnectionInfo,
) -> bool
fn answers_streamed_body( &self, _request: &Request, _connection: &ConnectionInfo, ) -> bool
true when this layer answers request itself — it doesn’t call
next — and reads its body as a stream (a proxy forwarding it as it
arrives). The body is then streamed whatever the layers after it and
the application would say. Requires accepts_streamed_body. Since
18.3.0.Auto Trait Implementations§
impl Freeze for BlocklistLayer
impl RefUnwindSafe for BlocklistLayer
impl Send for BlocklistLayer
impl Sync for BlocklistLayer
impl Unpin for BlocklistLayer
impl UnsafeUnpin for BlocklistLayer
impl UnwindSafe for BlocklistLayer
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