26 lines
683 B
Rust
26 lines
683 B
Rust
|
use tokio_rustls::rustls;
|
||
|
use std::sync::Arc;
|
||
|
|
||
|
pub fn config() -> rustls::ClientConfig {
|
||
|
let mut config = rustls::ClientConfig::new();
|
||
|
config
|
||
|
.dangerous()
|
||
|
.set_certificate_verifier(Arc::new(NoCertificateVerification {}));
|
||
|
|
||
|
config
|
||
|
}
|
||
|
|
||
|
struct NoCertificateVerification {}
|
||
|
|
||
|
impl rustls::ServerCertVerifier for NoCertificateVerification {
|
||
|
fn verify_server_cert(
|
||
|
&self,
|
||
|
_roots: &rustls::RootCertStore,
|
||
|
_presented_certs: &[rustls::Certificate],
|
||
|
_dns_name: webpki::DNSNameRef<'_>,
|
||
|
_ocsp: &[u8],
|
||
|
) -> Result<rustls::ServerCertVerified, rustls::TLSError> {
|
||
|
Ok(rustls::ServerCertVerified::assertion())
|
||
|
}
|
||
|
}
|