libp2p::relay

Trait RateLimiter

pub trait RateLimiter: Send {
    // Required method
    fn try_next(&mut self, peer: PeerId, addr: &Multiaddr, now: Instant) -> bool;
}
Available on crate feature relay only.
Expand description

Allows rate limiting access to some resource based on the PeerId and Multiaddr of a remote peer.

Required Methods§

fn try_next(&mut self, peer: PeerId, addr: &Multiaddr, now: Instant) -> bool

Implementors§

§

impl<T> RateLimiter for T
where T: FnMut(PeerId, &Multiaddr, Instant) -> bool + Send,