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
|
||||
|
||||
pub mod allow_all;
|
||||
pub mod fingerprint;
|
||||
pub mod verifier;
|
||||
|
||||
#[cfg(feature = "file-sscv")]
|
||||
pub mod file_sscv;
|
||||
|
|
|
@ -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,
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue