From cccee914d65c66257304ff229dc3f8b3a1afe733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Thu, 28 Oct 2021 01:57:16 +0200 Subject: [PATCH] aquatic_http: remove config fields previously used for mio impl --- aquatic_http/src/lib/config.rs | 68 ++-------------------------------- aquatic_http/src/lib/lib.rs | 4 +- 2 files changed, 6 insertions(+), 66 deletions(-) diff --git a/aquatic_http/src/lib/config.rs b/aquatic_http/src/lib/config.rs index 1e60db5..e2e3131 100644 --- a/aquatic_http/src/lib/config.rs +++ b/aquatic_http/src/lib/config.rs @@ -19,9 +19,7 @@ pub struct Config { pub log_level: LogLevel, pub network: NetworkConfig, pub protocol: ProtocolConfig, - pub handlers: HandlerConfig, pub cleaning: CleaningConfig, - pub statistics: StatisticsConfig, pub privileges: PrivilegeConfig, pub access_list: AccessListConfig, pub cpu_pinning: CpuPinningConfig, @@ -33,27 +31,15 @@ impl aquatic_cli_helpers::Config for Config { } } -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(default)] -pub struct TlsConfig { - pub use_tls: bool, - pub tls_pkcs12_path: String, - pub tls_pkcs12_password: String, - pub tls_certificate_path: PathBuf, - pub tls_private_key_path: PathBuf, -} - #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct NetworkConfig { /// Bind to this address pub address: SocketAddr, + pub tls_certificate_path: PathBuf, + pub tls_private_key_path: PathBuf, pub ipv6_only: bool, - #[serde(flatten)] - pub tls: TlsConfig, pub keep_alive: bool, - pub poll_event_capacity: usize, - pub poll_timeout_microseconds: u64, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -67,15 +53,6 @@ pub struct ProtocolConfig { pub peer_announce_interval: usize, } -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(default)] -pub struct HandlerConfig { - /// Maximum number of requests to receive from channel before locking - /// mutex and starting work - pub max_requests_per_iter: usize, - pub channel_recv_timeout_microseconds: u64, -} - #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default)] pub struct CleaningConfig { @@ -87,13 +64,6 @@ pub struct CleaningConfig { pub max_connection_age: u64, } -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(default)] -pub struct StatisticsConfig { - /// Print statistics this often (seconds). Don't print when set to zero. - pub interval: u64, -} - impl Default for Config { fn default() -> Self { Self { @@ -102,9 +72,7 @@ impl Default for Config { log_level: LogLevel::default(), network: NetworkConfig::default(), protocol: ProtocolConfig::default(), - handlers: HandlerConfig::default(), cleaning: CleaningConfig::default(), - statistics: StatisticsConfig::default(), privileges: PrivilegeConfig::default(), access_list: AccessListConfig::default(), cpu_pinning: Default::default(), @@ -116,11 +84,10 @@ impl Default for NetworkConfig { fn default() -> Self { Self { address: SocketAddr::from(([0, 0, 0, 0], 3000)), + tls_certificate_path: "".into(), + tls_private_key_path: "".into(), ipv6_only: false, - tls: TlsConfig::default(), keep_alive: true, - poll_event_capacity: 4096, - poll_timeout_microseconds: 200_000, } } } @@ -135,15 +102,6 @@ impl Default for ProtocolConfig { } } -impl Default for HandlerConfig { - fn default() -> Self { - Self { - max_requests_per_iter: 10_000, - channel_recv_timeout_microseconds: 200, - } - } -} - impl Default for CleaningConfig { fn default() -> Self { Self { @@ -153,21 +111,3 @@ impl Default for CleaningConfig { } } } - -impl Default for StatisticsConfig { - fn default() -> Self { - Self { interval: 0 } - } -} - -impl Default for TlsConfig { - fn default() -> Self { - Self { - use_tls: false, - tls_pkcs12_path: "".into(), - tls_pkcs12_password: "".into(), - tls_certificate_path: "".into(), - tls_private_key_path: "".into(), - } - } -} diff --git a/aquatic_http/src/lib/lib.rs b/aquatic_http/src/lib/lib.rs index 7ec1224..5a1d900 100644 --- a/aquatic_http/src/lib/lib.rs +++ b/aquatic_http/src/lib/lib.rs @@ -115,7 +115,7 @@ pub fn run(config: Config) -> anyhow::Result<()> { fn create_tls_config(config: &Config) -> anyhow::Result { let certs = { - let f = File::open(&config.network.tls.tls_certificate_path)?; + let f = File::open(&config.network.tls_certificate_path)?; let mut f = BufReader::new(f); rustls_pemfile::certs(&mut f)? @@ -125,7 +125,7 @@ fn create_tls_config(config: &Config) -> anyhow::Result { }; let private_key = { - let f = File::open(&config.network.tls.tls_private_key_path)?; + let f = File::open(&config.network.tls_private_key_path)?; let mut f = BufReader::new(f); rustls_pemfile::pkcs8_private_keys(&mut f)?