pub struct IpRate { /* private fields */ }Expand description
Rate limit connections by IP address.
Implementations§
Source§impl IpRate
impl IpRate
Sourcepub fn prune(&self)
pub fn prune(&self)
Prune entries that have tracked backwards 10s or more. The 10s just prevents hashtable thrashing if a connection is using significantly less than its rate limit. This is why the keepalive interval is 5 seconds and connections are closed after 10 seconds.
Sourcepub async fn is_blocked(&self, ip: &Arc<Ipv6Addr>) -> bool
pub async fn is_blocked(&self, ip: &Arc<Ipv6Addr>) -> bool
Return true if this ip is blocked.
Auto Trait Implementations§
impl Freeze for IpRate
impl RefUnwindSafe for IpRate
impl Send for IpRate
impl Sync for IpRate
impl Unpin for IpRate
impl UnwindSafe for IpRate
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