allow to turn off forced connection timeout

This commit is contained in:
Jun Kurihara 2024-02-01 18:07:41 +09:00
commit b2b3b05fcb
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
9 changed files with 41 additions and 19 deletions

View file

@ -27,7 +27,7 @@ rpxy-lib = { path = "../rpxy-lib/", default-features = false, features = [
anyhow = "1.0.79"
rustc-hash = "1.1.0"
serde = { version = "1.0.195", default-features = false, features = ["derive"] }
serde = { version = "1.0.196", default-features = false, features = ["derive"] }
derive_builder = "0.13.0"
tokio = { version = "1.35.1", default-features = false, features = [
"net",
@ -42,8 +42,8 @@ mimalloc = { version = "*", default-features = false }
# config
clap = { version = "4.4.18", features = ["std", "cargo", "wrap_help"] }
toml = { version = "0.8.8", default-features = false, features = ["parse"] }
hot_reload = "0.1.4"
toml = { version = "0.8.9", default-features = false, features = ["parse"] }
hot_reload = "0.1.5"
# logging
tracing = { version = "0.1.40" }

View file

@ -7,6 +7,7 @@ use rpxy_lib::{reexports::Uri, AppConfig, ProxyConfig, ReverseProxyConfig, TlsCo
use rustc_hash::FxHashMap as HashMap;
use serde::Deserialize;
use std::{fs, net::SocketAddr};
use tokio::time::Duration;
#[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)]
pub struct ConfigToml {
@ -48,6 +49,7 @@ pub struct Experimental {
#[cfg(feature = "cache")]
pub cache: Option<CacheOption>,
pub ignore_sni_consistency: Option<bool>,
pub connection_handling_timeout: Option<u64>,
}
#[derive(Deserialize, Debug, Default, PartialEq, Eq, Clone)]
@ -162,7 +164,7 @@ impl TryInto<ProxyConfig> for &ConfigToml {
if x == 0u64 {
proxy_config.h3_max_idle_timeout = None;
} else {
proxy_config.h3_max_idle_timeout = Some(tokio::time::Duration::from_secs(x))
proxy_config.h3_max_idle_timeout = Some(Duration::from_secs(x))
}
}
}
@ -172,6 +174,14 @@ impl TryInto<ProxyConfig> for &ConfigToml {
proxy_config.sni_consistency = !ignore;
}
if let Some(timeout) = exp.connection_handling_timeout {
if timeout == 0u64 {
proxy_config.connection_handling_timeout = Duration::from_secs(u64::MAX);
} else {
proxy_config.connection_handling_timeout = Duration::from_secs(timeout);
}
}
#[cfg(feature = "cache")]
if let Some(cache_option) = &exp.cache {
proxy_config.cache_enabled = true;