0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-25 23:48:21 -05:00
This commit is contained in:
Evan Yang 2024-11-01 19:55:51 +00:00 committed by GitHub
commit dffa9b6ee4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 0 deletions

View File

@ -53,6 +53,8 @@ pub struct Config {
pub proxy: Option<Proxy>, pub proxy: Option<Proxy>,
/// It stores the number of https connections to keep in the pool. /// It stores the number of https connections to keep in the pool.
pub number_of_https_connections: u8, pub number_of_https_connections: u8,
/// It stores the operating system's TLS certificates for https requests.
pub operating_system_tls_certificates: bool,
} }
impl Config { impl Config {

View File

@ -83,6 +83,8 @@ pub async fn aggregate(
.tcp_keepalive(Duration::from_secs(config.tcp_connection_keep_alive as u64)) .tcp_keepalive(Duration::from_secs(config.tcp_connection_keep_alive as u64))
.pool_max_idle_per_host(config.number_of_https_connections as usize) .pool_max_idle_per_host(config.number_of_https_connections as usize)
.connect_timeout(Duration::from_secs(config.request_timeout as u64)) // Add timeout to request to avoid DDOSing the server .connect_timeout(Duration::from_secs(config.request_timeout as u64)) // Add timeout to request to avoid DDOSing the server
.use_rustls_tls()
.tls_built_in_root_certs(config.operating_system_tls_certificates)
.https_only(true) .https_only(true)
.gzip(true) .gzip(true)
.brotli(true) .brotli(true)

View File

@ -19,6 +19,8 @@ rate_limiter = {
-- Set whether the server will use an adaptive/dynamic HTTPS window size, see https://httpwg.org/specs/rfc9113.html#fc-principles -- Set whether the server will use an adaptive/dynamic HTTPS window size, see https://httpwg.org/specs/rfc9113.html#fc-principles
https_adaptive_window_size = false https_adaptive_window_size = false
operating_system_tls_certificates = true -- Set whether the server will use operating system's tls certificates alongside rustls certificates while fetching search results from the upstream engines.
number_of_https_connections = 10 -- the number of https connections that should be available in the connection pool. number_of_https_connections = 10 -- the number of https connections that should be available in the connection pool.
-- Set keep-alive timer in seconds; keeps clients connected to the HTTP server, different from the connection to upstream search engines -- Set keep-alive timer in seconds; keeps clients connected to the HTTP server, different from the connection to upstream search engines
client_connection_keep_alive = 120 client_connection_keep_alive = 120