From 0e8d0238804e282838a3208050e78ac8e2ef4f0f Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Wed, 28 Aug 2024 17:19:18 +0400 Subject: [PATCH] refactor: rename allow_all->verifier, AllowAll->InternalCertVerifier --- src/certs/mod.rs | 2 +- src/certs/{allow_all.rs => verifier.rs} | 14 +++++++------- src/client/builder.rs | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/certs/{allow_all.rs => verifier.rs} (88%) diff --git a/src/certs/mod.rs b/src/certs/mod.rs index e4f30b7..219bb3d 100644 --- a/src/certs/mod.rs +++ b/src/certs/mod.rs @@ -1,7 +1,7 @@ //! Everything related to TLS certs verification -pub mod allow_all; pub mod fingerprint; +pub mod verifier; #[cfg(feature = "file-sscv")] pub mod file_sscv; diff --git a/src/certs/allow_all.rs b/src/certs/verifier.rs similarity index 88% rename from src/certs/allow_all.rs rename to src/certs/verifier.rs index 7a2ee68..23c3eff 100644 --- a/src/certs/allow_all.rs +++ b/src/certs/verifier.rs @@ -11,19 +11,19 @@ use tokio_rustls::rustls::{ /// Custom verifier for Rustls accepting any TLS certificate #[derive(Debug)] -pub struct AllowAllCertVerifier(Arc); +pub struct InternalCertVerifier(Arc); -impl Default for AllowAllCertVerifier { +impl Default for InternalCertVerifier { /// Same as [`AllowAllCertVerifier::new()`]. fn default() -> Self { Self::new() } } -impl AllowAllCertVerifier { +impl InternalCertVerifier { /// Constructor for this verifier. pub fn new() -> Self { - AllowAllCertVerifier( + InternalCertVerifier( CryptoProvider::get_default() .cloned() .unwrap_or_else(|| Arc::new(rustls::crypto::ring::default_provider())), @@ -31,14 +31,14 @@ impl AllowAllCertVerifier { } } -impl From> for AllowAllCertVerifier { +impl From> for InternalCertVerifier { #[inline] fn from(value: Arc) -> Self { - AllowAllCertVerifier(value) + InternalCertVerifier(value) } } -impl ServerCertVerifier for AllowAllCertVerifier { +impl ServerCertVerifier for InternalCertVerifier { #[inline] fn verify_server_cert( &self, diff --git a/src/client/builder.rs b/src/client/builder.rs index 7178cce..97daeb0 100644 --- a/src/client/builder.rs +++ b/src/client/builder.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use crate::{ - certs::{allow_all::AllowAllCertVerifier, SelfsignedCertVerifier}, + certs::{verifier::InternalCertVerifier, SelfsignedCertVerifier}, Client, }; @@ -56,7 +56,7 @@ impl ClientBuilder { }) .unwrap() .dangerous() - .with_custom_certificate_verifier(Arc::new(AllowAllCertVerifier::from(provider))); + .with_custom_certificate_verifier(Arc::new(InternalCertVerifier::from(provider))); // TODO let tls_config = tls_config.with_no_client_auth();