From 1eccb70aab42dc175dc8d9b96ccfd09f256f4227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Thu, 9 May 2024 12:26:16 +0200 Subject: [PATCH] lint --- src/main.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index c787046..8ce694c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -48,8 +48,8 @@ use crate::udp::MyUdpSocket; use tracing_subscriber::filter::Directive; use tracing_subscriber::EnvFilter; use url::{Host, Url}; -use x509_parser::{parse_x509_certificate}; -use x509_parser::prelude::{X509Certificate}; +use x509_parser::parse_x509_certificate; +use x509_parser::prelude::X509Certificate; const DEFAULT_CLIENT_UPGRADE_PATH_PREFIX: &str = "v1"; @@ -614,7 +614,9 @@ fn find_leaf_certificate(tls_certificates: &Vec) -> Option Option { - tls_certificate_x509.tbs_certificate.subject + tls_certificate_x509 + .tbs_certificate + .subject .iter_common_name() .flat_map(|cn| cn.as_str().ok()) .map(|cn| cn.to_string()) @@ -774,14 +776,14 @@ async fn main() { let http_upgrade_path_prefix = if args.http_upgrade_path_prefix.eq(DEFAULT_CLIENT_UPGRADE_PATH_PREFIX) { // When using mTLS and no manual http upgrade path is specified configure the HTTP upgrade path // to be the common name (CN) of the client's certificate. - tls_certificate.as_ref() - .and_then(|tls_certs| find_leaf_certificate(tls_certs)) + tls_certificate + .as_ref() + .and_then(find_leaf_certificate) .and_then(|leaf_cert| cn_from_certificate(&leaf_cert)) .unwrap_or(args.http_upgrade_path_prefix) } else { args.http_upgrade_path_prefix }; - println!("{}", http_upgrade_path_prefix); let transport_scheme = TransportScheme::from_str(args.remote_addr.scheme()).expect("invalid scheme in server url");