refactor: rename allow_all->verifier, AllowAll->InternalCertVerifier

This commit is contained in:
DarkCat09 2024-08-28 17:19:18 +04:00
parent 73addc33ca
commit 0e8d023880
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82
3 changed files with 10 additions and 10 deletions

View file

@ -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;

View file

@ -11,19 +11,19 @@ use tokio_rustls::rustls::{
/// Custom verifier for Rustls accepting any TLS certificate
#[derive(Debug)]
pub struct AllowAllCertVerifier(Arc<CryptoProvider>);
pub struct InternalCertVerifier(Arc<CryptoProvider>);
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<Arc<CryptoProvider>> for AllowAllCertVerifier {
impl From<Arc<CryptoProvider>> for InternalCertVerifier {
#[inline]
fn from(value: Arc<CryptoProvider>) -> Self {
AllowAllCertVerifier(value)
InternalCertVerifier(value)
}
}
impl ServerCertVerifier for AllowAllCertVerifier {
impl ServerCertVerifier for InternalCertVerifier {
#[inline]
fn verify_server_cert(
&self,

View file

@ -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();