mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
aquatic_http: remove config fields previously used for mio impl
This commit is contained in:
parent
f60631b29e
commit
cccee914d6
2 changed files with 6 additions and 66 deletions
|
|
@ -19,9 +19,7 @@ pub struct Config {
|
||||||
pub log_level: LogLevel,
|
pub log_level: LogLevel,
|
||||||
pub network: NetworkConfig,
|
pub network: NetworkConfig,
|
||||||
pub protocol: ProtocolConfig,
|
pub protocol: ProtocolConfig,
|
||||||
pub handlers: HandlerConfig,
|
|
||||||
pub cleaning: CleaningConfig,
|
pub cleaning: CleaningConfig,
|
||||||
pub statistics: StatisticsConfig,
|
|
||||||
pub privileges: PrivilegeConfig,
|
pub privileges: PrivilegeConfig,
|
||||||
pub access_list: AccessListConfig,
|
pub access_list: AccessListConfig,
|
||||||
pub cpu_pinning: CpuPinningConfig,
|
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)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct NetworkConfig {
|
pub struct NetworkConfig {
|
||||||
/// Bind to this address
|
/// Bind to this address
|
||||||
pub address: SocketAddr,
|
pub address: SocketAddr,
|
||||||
|
pub tls_certificate_path: PathBuf,
|
||||||
|
pub tls_private_key_path: PathBuf,
|
||||||
pub ipv6_only: bool,
|
pub ipv6_only: bool,
|
||||||
#[serde(flatten)]
|
|
||||||
pub tls: TlsConfig,
|
|
||||||
pub keep_alive: bool,
|
pub keep_alive: bool,
|
||||||
pub poll_event_capacity: usize,
|
|
||||||
pub poll_timeout_microseconds: u64,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
|
@ -67,15 +53,6 @@ pub struct ProtocolConfig {
|
||||||
pub peer_announce_interval: usize,
|
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)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub struct CleaningConfig {
|
pub struct CleaningConfig {
|
||||||
|
|
@ -87,13 +64,6 @@ pub struct CleaningConfig {
|
||||||
pub max_connection_age: u64,
|
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 {
|
impl Default for Config {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -102,9 +72,7 @@ impl Default for Config {
|
||||||
log_level: LogLevel::default(),
|
log_level: LogLevel::default(),
|
||||||
network: NetworkConfig::default(),
|
network: NetworkConfig::default(),
|
||||||
protocol: ProtocolConfig::default(),
|
protocol: ProtocolConfig::default(),
|
||||||
handlers: HandlerConfig::default(),
|
|
||||||
cleaning: CleaningConfig::default(),
|
cleaning: CleaningConfig::default(),
|
||||||
statistics: StatisticsConfig::default(),
|
|
||||||
privileges: PrivilegeConfig::default(),
|
privileges: PrivilegeConfig::default(),
|
||||||
access_list: AccessListConfig::default(),
|
access_list: AccessListConfig::default(),
|
||||||
cpu_pinning: Default::default(),
|
cpu_pinning: Default::default(),
|
||||||
|
|
@ -116,11 +84,10 @@ impl Default for NetworkConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
address: SocketAddr::from(([0, 0, 0, 0], 3000)),
|
address: SocketAddr::from(([0, 0, 0, 0], 3000)),
|
||||||
|
tls_certificate_path: "".into(),
|
||||||
|
tls_private_key_path: "".into(),
|
||||||
ipv6_only: false,
|
ipv6_only: false,
|
||||||
tls: TlsConfig::default(),
|
|
||||||
keep_alive: true,
|
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 {
|
impl Default for CleaningConfig {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
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(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ pub fn run(config: Config) -> anyhow::Result<()> {
|
||||||
|
|
||||||
fn create_tls_config(config: &Config) -> anyhow::Result<rustls::ServerConfig> {
|
fn create_tls_config(config: &Config) -> anyhow::Result<rustls::ServerConfig> {
|
||||||
let certs = {
|
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);
|
let mut f = BufReader::new(f);
|
||||||
|
|
||||||
rustls_pemfile::certs(&mut f)?
|
rustls_pemfile::certs(&mut f)?
|
||||||
|
|
@ -125,7 +125,7 @@ fn create_tls_config(config: &Config) -> anyhow::Result<rustls::ServerConfig> {
|
||||||
};
|
};
|
||||||
|
|
||||||
let private_key = {
|
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);
|
let mut f = BufReader::new(f);
|
||||||
|
|
||||||
rustls_pemfile::pkcs8_private_keys(&mut f)?
|
rustls_pemfile::pkcs8_private_keys(&mut f)?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue