nits
This commit is contained in:
parent
66330162f3
commit
0f44f71289
4 changed files with 8 additions and 8 deletions
|
|
@ -80,7 +80,7 @@ impl Backend {
|
||||||
let mut reader = BufReader::new(File::open(certs_path).map_err(|e| {
|
let mut reader = BufReader::new(File::open(certs_path).map_err(|e| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
e.kind(),
|
e.kind(),
|
||||||
format!("Unable to load the certificates [{}]: {}", certs_path_str, e),
|
format!("Unable to load the certificates [{certs_path_str}]: {e}"),
|
||||||
)
|
)
|
||||||
})?);
|
})?);
|
||||||
rustls_pemfile::certs(&mut reader)
|
rustls_pemfile::certs(&mut reader)
|
||||||
|
|
@ -97,7 +97,7 @@ impl Backend {
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
e.kind(),
|
e.kind(),
|
||||||
format!("Unable to load the certificate keys [{}]: {}", certs_keys_path_str, e),
|
format!("Unable to load the certificate keys [{certs_keys_path_str}]: {e}"),
|
||||||
)
|
)
|
||||||
})?
|
})?
|
||||||
.read_to_end(&mut encoded_keys)?;
|
.read_to_end(&mut encoded_keys)?;
|
||||||
|
|
@ -155,7 +155,7 @@ impl Backend {
|
||||||
let mut reader = BufReader::new(File::open(client_ca_cert_path).map_err(|e| {
|
let mut reader = BufReader::new(File::open(client_ca_cert_path).map_err(|e| {
|
||||||
io::Error::new(
|
io::Error::new(
|
||||||
e.kind(),
|
e.kind(),
|
||||||
format!("Unable to load the client certificates [{}]: {}", certs_path_str, e),
|
format!("Unable to load the client certificates [{certs_path_str}]: {e}"),
|
||||||
)
|
)
|
||||||
})?);
|
})?);
|
||||||
rustls_pemfile::certs(&mut reader)
|
rustls_pemfile::certs(&mut reader)
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,10 @@ pub fn parse_opts(globals: &mut Globals) -> std::result::Result<(), anyhow::Erro
|
||||||
.flat_map(|x| {
|
.flat_map(|x| {
|
||||||
let mut v: Vec<SocketAddr> = vec![];
|
let mut v: Vec<SocketAddr> = vec![];
|
||||||
if let Some(p) = globals.http_port {
|
if let Some(p) = globals.http_port {
|
||||||
v.push(format!("{}:{}", x, p).parse().unwrap());
|
v.push(format!("{x}:{p}").parse().unwrap());
|
||||||
}
|
}
|
||||||
if let Some(p) = globals.https_port {
|
if let Some(p) = globals.https_port {
|
||||||
v.push(format!("{}:{}", x, p).parse().unwrap());
|
v.push(format!("{x}:{p}").parse().unwrap());
|
||||||
}
|
}
|
||||||
v
|
v
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ pub(super) fn secure_redirection<B>(
|
||||||
let new_uri = Uri::builder().scheme("https").path_and_query(pq);
|
let new_uri = Uri::builder().scheme("https").path_and_query(pq);
|
||||||
let dest_uri = match tls_port {
|
let dest_uri = match tls_port {
|
||||||
Some(443) | None => new_uri.authority(server_name),
|
Some(443) | None => new_uri.authority(server_name),
|
||||||
Some(p) => new_uri.authority(format!("{}:{}", server_name, p)),
|
Some(p) => new_uri.authority(format!("{server_name}:{p}")),
|
||||||
}
|
}
|
||||||
.build()?;
|
.build()?;
|
||||||
let response = Response::builder()
|
let response = Response::builder()
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ where
|
||||||
let handshake_fut = async move {
|
let handshake_fut = async move {
|
||||||
let acceptor = tokio_rustls::LazyConfigAcceptor::new(rustls::server::Acceptor::default(), raw_stream).await;
|
let acceptor = tokio_rustls::LazyConfigAcceptor::new(rustls::server::Acceptor::default(), raw_stream).await;
|
||||||
if let Err(e) = acceptor {
|
if let Err(e) = acceptor {
|
||||||
return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {}", e)));
|
return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {e}")));
|
||||||
}
|
}
|
||||||
let start = acceptor.unwrap();
|
let start = acceptor.unwrap();
|
||||||
let client_hello = start.client_hello();
|
let client_hello = start.client_hello();
|
||||||
|
|
@ -80,7 +80,7 @@ where
|
||||||
let stream = match start.into_stream(server_crypto.unwrap().clone()).await {
|
let stream = match start.into_stream(server_crypto.unwrap().clone()).await {
|
||||||
Ok(s) => s,
|
Ok(s) => s,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {}", e)));
|
return Err(RpxyError::Proxy(format!("Failed to handshake TLS: {e}")));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self_inner.client_serve(stream, server_clone, client_addr, server_name);
|
self_inner.client_serve(stream, server_clone, client_addr, server_name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue