diff --git a/src/certs/file/sscv.rs b/src/certs/file/sscv.rs index 6065c2e..8a510d9 100644 --- a/src/certs/file/sscv.rs +++ b/src/certs/file/sscv.rs @@ -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 dashmap::DashMap; @@ -5,6 +8,10 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufWriter}; 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 { fd: Mutex, map: DashMap, @@ -89,6 +96,7 @@ impl KnownHostsFile { Ok(KnownHostsFile { fd, map }) } + /// Get a known certificate fingerprint from the in-memory hashmap pub fn get_known_cert( &self, host: &str,