Trait libp2p_relay::v2::relay::rate_limiter::RateLimiter
source · pub trait RateLimiter: Send {
fn try_next(&mut self, peer: PeerId, addr: &Multiaddr, now: Instant) -> bool;
}
Expand description
Allows rate limiting access to some resource based on the PeerId
and
Multiaddr
of a remote peer.
See new_per_peer
and new_per_ip
for precast implementations. Use
GenericRateLimiter
to build your own, e.g. based on the autonomous system
number of a peers IP address.