docs: add/update for file::sscv
This commit is contained in:
parent
666196c103
commit
7b9d2a976e
1 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
//! Utils for self-signed server certificate verifying
|
||||||
|
//! using a file with known hosts
|
||||||
|
|
||||||
use std::{borrow::Cow, os::fd::AsFd, path::Path, sync::Mutex};
|
use std::{borrow::Cow, os::fd::AsFd, path::Path, sync::Mutex};
|
||||||
|
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
|
@ -5,6 +8,10 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufWriter};
|
||||||
|
|
||||||
use crate::certs::{fingerprint::CertFingerprint, SelfsignedCert};
|
use crate::certs::{fingerprint::CertFingerprint, SelfsignedCert};
|
||||||
|
|
||||||
|
/// Structure holding a known_hosts file descriptor
|
||||||
|
/// and an in-memory host-to-fingerprint hashmap,
|
||||||
|
/// providing a handy API to parse such files,
|
||||||
|
/// to get or store a cert fingerprint
|
||||||
pub struct KnownHostsFile {
|
pub struct KnownHostsFile {
|
||||||
fd: Mutex<std::os::fd::OwnedFd>,
|
fd: Mutex<std::os::fd::OwnedFd>,
|
||||||
map: DashMap<String, SelfsignedCert>,
|
map: DashMap<String, SelfsignedCert>,
|
||||||
|
@ -89,6 +96,7 @@ impl KnownHostsFile {
|
||||||
Ok(KnownHostsFile { fd, map })
|
Ok(KnownHostsFile { fd, map })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a known certificate fingerprint from the in-memory hashmap
|
||||||
pub fn get_known_cert(
|
pub fn get_known_cert(
|
||||||
&self,
|
&self,
|
||||||
host: &str,
|
host: &str,
|
||||||
|
|
Loading…
Add table
Reference in a new issue