change hyper-trust-dns to hyper-rustls for httpsconnector
This commit is contained in:
parent
3491b80142
commit
65ade6df8c
4 changed files with 27 additions and 12 deletions
20
Cargo.toml
20
Cargo.toml
|
|
@ -40,16 +40,24 @@ tokio-rustls = { version = "0.23.4", features = [
|
||||||
"early-data",
|
"early-data",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
rustls-pemfile = { version = "1.0.0", 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"
|
rustls = "0.20.6"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
toml = "0.5.9"
|
toml = "0.5.9"
|
||||||
serde = { version = "1.0.137", features = ["derive"] }
|
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]
|
[dev-dependencies]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
echo "----------------------------"
|
echo "----------------------------"
|
||||||
echo "Benchmark on rpxy"
|
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 "----------------------------"
|
||||||
echo "Benchmark on nginx"
|
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 "----------------------------"
|
||||||
echo "Benchmark on caddy"
|
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/
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@ server_name = 'localhost'
|
||||||
reverse_proxy = [
|
reverse_proxy = [
|
||||||
# default destination if path is not specified
|
# default destination if path is not specified
|
||||||
# Array for load balancing
|
# 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 }] },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
10
src/main.rs
10
src/main.rs
|
|
@ -20,7 +20,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
use futures::future::select_all;
|
use futures::future::select_all;
|
||||||
use hyper::Client;
|
use hyper::Client;
|
||||||
use hyper_trust_dns::TrustDnsResolver;
|
// use hyper_trust_dns::TrustDnsResolver;
|
||||||
use std::{collections::HashMap, io::Write, sync::Arc};
|
use std::{collections::HashMap, io::Write, sync::Arc};
|
||||||
use tokio::time::Duration;
|
use tokio::time::Duration;
|
||||||
|
|
||||||
|
|
@ -77,7 +77,13 @@ fn main() {
|
||||||
|
|
||||||
// entrypoint creates and spawns tasks of proxy services
|
// entrypoint creates and spawns tasks of proxy services
|
||||||
async fn entrypoint(globals: Arc<Globals>, backends: Arc<Backends>) -> Result<()> {
|
async fn entrypoint(globals: Arc<Globals>, backends: Arc<Backends>) -> 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 forwarder = Arc::new(Client::builder().build::<_, hyper::Body>(connector));
|
||||||
|
|
||||||
let addresses = globals.listen_sockets.clone();
|
let addresses = globals.listen_sockets.clone();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue