add DnsClient arg to file_sscv init(), update main.rs example
This commit is contained in:
parent
9806eb6a02
commit
4314df372b
2 changed files with 92 additions and 31 deletions
|
@ -15,15 +15,21 @@ use crate::{
|
|||
LibError,
|
||||
};
|
||||
|
||||
#[cfg(feature = "hickory")]
|
||||
use crate::dns::DnsClient;
|
||||
|
||||
pub struct FileBasedCertVerifier {
|
||||
fd: Mutex<std::os::fd::OwnedFd>,
|
||||
map: DashMap<String, SelfsignedCert>,
|
||||
#[cfg(feature = "hickory")]
|
||||
dns: Option<crate::dns::DnsClient>,
|
||||
dns: Option<DnsClient>,
|
||||
}
|
||||
|
||||
impl FileBasedCertVerifier {
|
||||
pub async fn init(path: impl AsRef<Path>) -> Result<Self, LibError> {
|
||||
pub async fn init(
|
||||
path: impl AsRef<Path>,
|
||||
#[cfg(feature = "hickory")] dns: Option<DnsClient>,
|
||||
) -> Result<Self, LibError> {
|
||||
let map = DashMap::new();
|
||||
|
||||
if tokio::fs::try_exists(&path).await? {
|
||||
|
@ -97,7 +103,7 @@ impl FileBasedCertVerifier {
|
|||
fd,
|
||||
map,
|
||||
#[cfg(feature = "hickory")]
|
||||
dns: None,
|
||||
dns,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue