wip: refactoring all the structure and improve error messages

This commit is contained in:
Jun Kurihara 2023-11-22 22:48:14 +09:00
commit de91c7a68f
No known key found for this signature in database
GPG key ID: 6D3FEE70E498C15B
10 changed files with 268 additions and 56 deletions

22
rpxy-lib/src/proxy/mod.rs Normal file
View file

@ -0,0 +1,22 @@
mod proxy_main;
mod socket;
use crate::{globals::Globals, hyper_executor::LocalExecutor};
use hyper_util::server::{self, conn::auto::Builder as ConnectionBuilder};
use std::sync::Arc;
pub(crate) use proxy_main::Proxy;
/// build connection builder shared with proxy instances
pub(crate) fn connection_builder(globals: &Arc<Globals>) -> Arc<ConnectionBuilder<LocalExecutor>> {
let executor = LocalExecutor::new(globals.runtime_handle.clone());
let mut http_server = server::conn::auto::Builder::new(executor);
http_server
.http1()
.keep_alive(globals.proxy_config.keepalive)
.pipeline_flush(true);
http_server
.http2()
.max_concurrent_streams(globals.proxy_config.max_concurrent_streams);
Arc::new(http_server)
}