From c3c3a07cae6a938534824c32573927dd7a5ece4b Mon Sep 17 00:00:00 2001 From: metamuffin Date: Thu, 6 Apr 2023 17:51:42 +0200 Subject: configure max_incoming_connections --- src/config.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/config.rs') diff --git a/src/config.rs b/src/config.rs index 58b885a..68479e4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,9 +6,20 @@ use std::{collections::HashMap, fs::read_to_string, net::SocketAddr, path::PathB pub struct Config { pub http: Option, pub https: Option, + #[serde(default)] + pub limits: Limits, + #[serde(default)] pub hosts: HashMap, } +#[derive(Debug, Serialize, Deserialize)] +pub struct Limits { + #[serde(default)] + pub max_incoming_connections: usize, + #[serde(default)] + pub max_outgoing_connections: usize, +} + #[derive(Debug, Serialize, Deserialize)] pub struct HttpConfig { pub bind: SocketAddr, @@ -42,3 +53,12 @@ impl Config { Ok(config) } } + +impl Default for Limits { + fn default() -> Self { + Self { + max_incoming_connections: 1024, + max_outgoing_connections: usize::MAX, + } + } +} -- cgit v1.2.3-70-g09d2