mirror of
https://github.com/chatmail/relay.git
synced 2026-09-16 04:13:13 +00:00
feat: Configurable rate limiter max burst size (#28)
Signed-off-by: Jagoda Ślązak <jslazak@jslazak.com>
This commit is contained in:
committed by
GitHub
parent
9a8e4fe65c
commit
23231d462c
@@ -17,7 +17,10 @@ pub struct Config {
|
||||
pub postfix_reinject_port_incoming: u16,
|
||||
#[serde(default = "Config::default_max_message_size")]
|
||||
pub max_message_size: usize,
|
||||
#[serde(default = "Config::default_max_user_send_per_minute")]
|
||||
pub max_user_send_per_minute: NonZeroU32,
|
||||
#[serde(default = "Config::default_max_user_send_burst_size")]
|
||||
pub max_user_send_burst_size: NonZeroU32,
|
||||
#[serde(default, deserialize_with = "deserialize_sequence")]
|
||||
pub passthrough_senders: Vec<String>,
|
||||
#[serde(default, deserialize_with = "deserialize_sequence")]
|
||||
@@ -94,4 +97,10 @@ impl Config {
|
||||
const fn default_max_message_size() -> usize {
|
||||
31457280
|
||||
}
|
||||
const fn default_max_user_send_per_minute() -> NonZeroU32 {
|
||||
NonZeroU32::new(60).expect("60 != 0")
|
||||
}
|
||||
const fn default_max_user_send_burst_size() -> NonZeroU32 {
|
||||
NonZeroU32::new(10).expect("10 != 0")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user