From 2dc4652276eef3edf2739ba7831e6b37d0ec383a Mon Sep 17 00:00:00 2001 From: Darius Date: Sat, 29 Jul 2023 10:59:14 -0400 Subject: [PATCH] chore: Split Config functions per reservation and circuit-src --- protocols/relay/src/behaviour.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/protocols/relay/src/behaviour.rs b/protocols/relay/src/behaviour.rs index 55404d72a18..8fcfa103c4f 100644 --- a/protocols/relay/src/behaviour.rs +++ b/protocols/relay/src/behaviour.rs @@ -62,11 +62,15 @@ pub struct Config { } impl Config { - pub fn per_peer(mut self, limit: NonZeroU32, interval: Duration) -> Self { + pub fn reservation_rate_per_peer(mut self, limit: NonZeroU32, interval: Duration) -> Self { self.reservation_rate_limiters .push(rate_limiter::new_per_peer( rate_limiter::GenericRateLimiterConfig { limit, interval }, )); + self + } + + pub fn circuit_src_per_peer(mut self, limit: NonZeroU32, interval: Duration) -> Self { self.circuit_src_rate_limiters .push(rate_limiter::new_per_peer( rate_limiter::GenericRateLimiterConfig { limit, interval }, @@ -74,11 +78,15 @@ impl Config { self } - pub fn per_ip(mut self, limit: NonZeroU32, interval: Duration) -> Self { + pub fn reservation_rate_per_ip(mut self, limit: NonZeroU32, interval: Duration) -> Self { self.reservation_rate_limiters .push(rate_limiter::new_per_ip( rate_limiter::GenericRateLimiterConfig { limit, interval }, )); + self + } + + pub fn circuit_src_per_ip(mut self, limit: NonZeroU32, interval: Duration) -> Self { self.circuit_src_rate_limiters .push(rate_limiter::new_per_ip( rate_limiter::GenericRateLimiterConfig { limit, interval },