Skip to main content

CertStore

Struct CertStore 

Source
pub struct CertStore<E: EntryKey> {
    pub by_sni: HashMap<String, Arc<E>>,
    pub default: Option<Arc<E>>,
}
Expand description

Per-listener cert pool: zero-or-more SNI-keyed entries plus an optional sni-less default. The default fires when a ClientHello has no SNI extension or when the SNI does not match any Self::by_sni key. A listener has at most one default.

Keys in Self::by_sni are stored ASCII-lowercase per RFC 6066 § 3 (server_name is already ASCII-lowercased by rustls), so resolver-side lookups are byte-for-byte without an eq_ignore_ascii_case shim.

Fields§

§by_sni: HashMap<String, Arc<E>>§default: Option<Arc<E>>

Implementations§

Source§

impl<E: EntryKey> CertStore<E>

Source

pub fn new() -> Self

Source

pub fn lookup(&self, sni: Option<&str>) -> Option<Arc<CertifiedKey>>

Resolve a ClientHello’s SNI against the store. The hot-path resolver delegates to this so unit tests can exercise the lookup without constructing a rustls::ClientHello (which is not user-constructible). sni is expected to already be ASCII-lowercased by rustls per RFC 6066 § 3.

Trait Implementations§

Source§

impl<E: Debug + EntryKey> Debug for CertStore<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: EntryKey> Default for CertStore<E>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<E> Freeze for CertStore<E>

§

impl<E> RefUnwindSafe for CertStore<E>
where E: RefUnwindSafe,

§

impl<E> Send for CertStore<E>
where E: Sync + Send,

§

impl<E> Sync for CertStore<E>
where E: Sync + Send,

§

impl<E> Unpin for CertStore<E>

§

impl<E> UnsafeUnpin for CertStore<E>

§

impl<E> UnwindSafe for CertStore<E>
where E: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.