pub struct RateLimiter {
pub rpm_limit: u32,
/* private fields */
}
Expand description
Rate limiter for controlling request frequency
Fields§
§rpm_limit: u32
Requests per minute limit
Implementations§
Source§impl RateLimiter
impl RateLimiter
Sourcepub async fn is_allowed(&self, peer_id: &PeerId) -> bool
pub async fn is_allowed(&self, peer_id: &PeerId) -> bool
Check if request is allowed for peer
Sourcepub async fn reset_peer(&self, peer_id: &PeerId)
pub async fn reset_peer(&self, peer_id: &PeerId)
Reset rate limit for peer (admin function)
Trait Implementations§
Source§impl Clone for RateLimiter
impl Clone for RateLimiter
Source§fn clone(&self) -> RateLimiter
fn clone(&self) -> RateLimiter
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for RateLimiter
impl !RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl !UnwindSafe for RateLimiter
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