diff --git a/Cargo.toml b/Cargo.toml index 87f2273..2c2b629 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,16 +40,24 @@ tokio-rustls = { version = "0.23.4", features = [ "early-data", ], optional = true } rustls-pemfile = { version = "1.0.0", optional = true } -hyper-trust-dns = { version = "0.4.2", default-features = false, features = [ - "rustls-http2", - "dnssec-ring", - "dns-over-https-rustls", - "rustls-webpki", -] } rustls = "0.20.6" rand = "0.8.5" toml = "0.5.9" serde = { version = "1.0.137", features = ["derive"] } +hyper-rustls = { version = "0.23.0", default-features = false, features = [ + "tokio-runtime", + "webpki-tokio", + "http1", + "http2", +] } +# hyper-trust-dns = { version = "0.4.2", default-features = false, features = [ +# "rustls-http2", +# "dnssec-ring", +# "dns-over-https-rustls", +# "rustls-webpki", +# "rustls-native", +# "native-tls", +# ] } [dev-dependencies] diff --git a/bench/bench.sh b/bench/bench.sh index 4112376..50542d6 100644 --- a/bench/bench.sh +++ b/bench/bench.sh @@ -2,12 +2,12 @@ echo "----------------------------" echo "Benchmark on rpxy" -ab -c 32 -n 10000 http://127.0.0.1:8080/ # TODO: localhost = 127.0.0.1を解決できるように決めておかんとだめそう +ab -c 10 -n 10000 http://127.0.0.1:8080/ # TODO: localhost = 127.0.0.1を解決できるように決めておかんとだめそう echo "----------------------------" echo "Benchmark on nginx" -ab -c 32 -n 10000 http://127.0.0.1:8090/ +ab -c 10 -n 10000 http://127.0.0.1:8090/ echo "----------------------------" echo "Benchmark on caddy" -ab -c 32 -n 10000 http://127.0.0.1:8100/ +ab -c 10 -n 10000 http://127.0.0.1:8100/ diff --git a/bench/rpxy.toml b/bench/rpxy.toml index 682863e..5841808 100644 --- a/bench/rpxy.toml +++ b/bench/rpxy.toml @@ -14,5 +14,6 @@ server_name = 'localhost' reverse_proxy = [ # default destination if path is not specified # Array for load balancing - { upstream = [{ location = '192.168.100.100', tls = false }] }, + { upstream = [{ location = 'backend-nginx', tls = false }] }, + # { upstream = [{ location = '192.168.100.100', tls = false }] }, ] diff --git a/src/main.rs b/src/main.rs index fa9640f..e376006 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,7 +20,7 @@ use crate::{ }; use futures::future::select_all; use hyper::Client; -use hyper_trust_dns::TrustDnsResolver; +// use hyper_trust_dns::TrustDnsResolver; use std::{collections::HashMap, io::Write, sync::Arc}; use tokio::time::Duration; @@ -77,7 +77,13 @@ fn main() { // entrypoint creates and spawns tasks of proxy services async fn entrypoint(globals: Arc, backends: Arc) -> Result<()> { - let connector = TrustDnsResolver::default().into_rustls_webpki_https_connector(); + // let connector = TrustDnsResolver::default().into_rustls_webpki_https_connector(); + let connector = hyper_rustls::HttpsConnectorBuilder::new() + .with_webpki_roots() + .https_or_http() + .enable_http1() + .enable_http2() + .build(); let forwarder = Arc::new(Client::builder().build::<_, hyper::Body>(connector)); let addresses = globals.listen_sockets.clone();