pub struct NoopDdosProtection;Expand description
No-op DDoS protection — allows all requests unconditionally. Use this in general integration tests where DDoS behaviour is not under test.
Implementations§
Trait Implementations§
Source§impl DdosProtection for NoopDdosProtection
impl DdosProtection for NoopDdosProtection
Source§fn allow_request(&self, _ip: &str) -> bool
fn allow_request(&self, _ip: &str) -> bool
Returns
true if the request from ip should be processed, false if it should be
dropped immediately.Source§fn report_bad_request(&self, _ip: &str)
fn report_bad_request(&self, _ip: &str)
Notify the implementation that a request from
ip was rejected. Implementations
should use this to accumulate evidence and eventually ban repeat offenders.Source§fn try_acquire_connection(&self, _ip: &str) -> bool
fn try_acquire_connection(&self, _ip: &str) -> bool
Try to acquire a connection slot for
ip, checking both the ban score and the
per-IP connection cap. Returns true and increments the connection count on
success. Returns false if the IP is blocked or over the per-IP cap. Read moreSource§fn release_connection(&self, _ip: &str)
fn release_connection(&self, _ip: &str)
Release a connection slot previously acquired by
try_acquire_connection.
Called automatically by DdosConnectionGuard::drop.Auto Trait Implementations§
impl Freeze for NoopDdosProtection
impl RefUnwindSafe for NoopDdosProtection
impl Send for NoopDdosProtection
impl Sync for NoopDdosProtection
impl Unpin for NoopDdosProtection
impl UnsafeUnpin for NoopDdosProtection
impl UnwindSafe for NoopDdosProtection
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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