Fix record feature optional
This commit is contained in:
parent
1af09f72e9
commit
e44cbc1e26
1 changed files with 6 additions and 0 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::util::SigAlg;
|
use crate::util::SigAlg;
|
||||||
|
|
||||||
|
#[cfg(feature = "record")]
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
use log::error;
|
use log::error;
|
||||||
|
#[cfg(feature = "record")]
|
||||||
use openssl::{pkey::PKey, x509::X509};
|
use openssl::{pkey::PKey, x509::X509};
|
||||||
use std::{
|
use std::{
|
||||||
collections::{BTreeMap, HashMap, btree_map},
|
collections::{BTreeMap, HashMap, btree_map},
|
||||||
|
|
@ -37,6 +39,7 @@ static TEST_RECORD: &[(u64, &str, Direction, &[u8])] =
|
||||||
//(1, "upload.wikimedia.org", Direction::ServerToClient, b"0\r\n\r\n"),
|
//(1, "upload.wikimedia.org", Direction::ServerToClient, b"0\r\n\r\n"),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
#[cfg(feature = "record")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct LyingCertificateRegistry {
|
pub struct LyingCertificateRegistry {
|
||||||
by_name: DashMap<String, &'static openssl::ssl::SslContext>,
|
by_name: DashMap<String, &'static openssl::ssl::SslContext>,
|
||||||
|
|
@ -44,6 +47,7 @@ pub struct LyingCertificateRegistry {
|
||||||
certs_dir: PathBuf,
|
certs_dir: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "record")]
|
||||||
impl LyingCertificateRegistry {
|
impl LyingCertificateRegistry {
|
||||||
pub fn new(ca_dir: &str, certs_dir: &str) -> Self {
|
pub fn new(ca_dir: &str, certs_dir: &str) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
|
@ -366,6 +370,7 @@ impl LyingCertificateRegistry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "record")]
|
||||||
pub static CERTIFICATES: OnceLock<LyingCertificateRegistry> = OnceLock::new();
|
pub static CERTIFICATES: OnceLock<LyingCertificateRegistry> = OnceLock::new();
|
||||||
|
|
||||||
fn write_record(
|
fn write_record(
|
||||||
|
|
@ -475,6 +480,7 @@ impl sslrelay::HandlerCallbacks for Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "record")]
|
||||||
fn servername_callback(
|
fn servername_callback(
|
||||||
ssl: &mut openssl::ssl::SslRef,
|
ssl: &mut openssl::ssl::SslRef,
|
||||||
_alert: &mut openssl::ssl::SslAlert,
|
_alert: &mut openssl::ssl::SslAlert,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue