refactor: rename allow_all->verifier, AllowAll->InternalCertVerifier
This commit is contained in:
parent
73addc33ca
commit
0e8d023880
3 changed files with 10 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
||||||
//! Everything related to TLS certs verification
|
//! Everything related to TLS certs verification
|
||||||
|
|
||||||
pub mod allow_all;
|
|
||||||
pub mod fingerprint;
|
pub mod fingerprint;
|
||||||
|
pub mod verifier;
|
||||||
|
|
||||||
#[cfg(feature = "file-sscv")]
|
#[cfg(feature = "file-sscv")]
|
||||||
pub mod file_sscv;
|
pub mod file_sscv;
|
||||||
|
|
|
@ -11,19 +11,19 @@ use tokio_rustls::rustls::{
|
||||||
|
|
||||||
/// Custom verifier for Rustls accepting any TLS certificate
|
/// Custom verifier for Rustls accepting any TLS certificate
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct AllowAllCertVerifier(Arc<CryptoProvider>);
|
pub struct InternalCertVerifier(Arc<CryptoProvider>);
|
||||||
|
|
||||||
impl Default for AllowAllCertVerifier {
|
impl Default for InternalCertVerifier {
|
||||||
/// Same as [`AllowAllCertVerifier::new()`].
|
/// Same as [`AllowAllCertVerifier::new()`].
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AllowAllCertVerifier {
|
impl InternalCertVerifier {
|
||||||
/// Constructor for this verifier.
|
/// Constructor for this verifier.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
AllowAllCertVerifier(
|
InternalCertVerifier(
|
||||||
CryptoProvider::get_default()
|
CryptoProvider::get_default()
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_else(|| Arc::new(rustls::crypto::ring::default_provider())),
|
.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]
|
#[inline]
|
||||||
fn from(value: Arc<CryptoProvider>) -> Self {
|
fn from(value: Arc<CryptoProvider>) -> Self {
|
||||||
AllowAllCertVerifier(value)
|
InternalCertVerifier(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerCertVerifier for AllowAllCertVerifier {
|
impl ServerCertVerifier for InternalCertVerifier {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn verify_server_cert(
|
fn verify_server_cert(
|
||||||
&self,
|
&self,
|
|
@ -3,7 +3,7 @@
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
certs::{allow_all::AllowAllCertVerifier, SelfsignedCertVerifier},
|
certs::{verifier::InternalCertVerifier, SelfsignedCertVerifier},
|
||||||
Client,
|
Client,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ impl ClientBuilder {
|
||||||
})
|
})
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.dangerous()
|
.dangerous()
|
||||||
.with_custom_certificate_verifier(Arc::new(AllowAllCertVerifier::from(provider)));
|
.with_custom_certificate_verifier(Arc::new(InternalCertVerifier::from(provider)));
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
let tls_config = tls_config.with_no_client_auth();
|
let tls_config = tls_config.with_no_client_auth();
|
||||||
|
|
Loading…
Reference in a new issue