Skip to main content

Resolver

Struct Resolver 

Source
pub struct Resolver { /* private fields */ }
Expand description

The SNI resolver. Share it as Arc<Resolver>.

Implementations§

Source§

impl Resolver

Source

pub fn new() -> Self

An empty resolver.

Source

pub fn with_self_signed(names: &[String]) -> Result<Self>

A resolver with a fresh self-signed certificate for names, also the default, so TLS keeps working before any other certificate arrives.

Source

pub fn set(&self, source: Source, pair: &CertPair) -> Result<CertInfo>

Installs pair from source for every DNS name in it; returns what it says.

Source

pub fn set_key(&self, source: Source, key: Arc<CertifiedKey>, info: &CertInfo)

Installs a built key from source for the names in info.

Source

pub fn pin(&self, pattern: &str, pair: &CertPair) -> Result<CertInfo>

Pins pair for pattern (a name or *. wildcard), whatever the certificate’s names.

Source

pub fn remove(&self, name: &str, source: Source)

Removes the certificate from source for name.

Source

pub fn set_default(&self, key: Arc<CertifiedKey>, not_after: SystemTime)

The certificate for handshakes without SNI or with an unknown name; lookups report it as Source::SelfSigned (see Resolver::set_default_as).

Source

pub fn set_default_as( &self, source: Source, key: Arc<CertifiedKey>, not_after: SystemTime, )

Resolver::set_default for a key from source, which lookups report.

Source

pub fn set_default_pair( &self, source: Source, pair: &CertPair, ) -> Result<CertInfo>

Makes pair from source the default certificate; returns what it says.

Source

pub fn default_source(&self) -> Option<Source>

The default certificate’s source, if one is set.

Source

pub fn clear_default(&self)

Clears the default certificate.

Source

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

The certificate and its source a handshake for sni gets now.

Source

pub fn lookup_at( &self, sni: Option<&str>, now: SystemTime, ) -> Option<(Source, Arc<CertifiedKey>)>

Resolver::lookup at time now.

Source

pub fn challenge_config(self: &Arc<Self>) -> Result<Arc<ServerConfig>>

A rustls server config that answers only TLS-ALPN-01 validation (ALPN acme-tls/1) with this resolver’s challenge certificates, and fails every other handshake: for a challenge-only listener while the app’s own HTTPS listener isn’t running (see crate::challenge::serve_tls_alpn01).

Source

pub fn has_alpn(&self, name: &str) -> bool

True while a TLS-ALPN-01 answer for name is published.

Source

pub fn server_config( self: &Arc<Self>, alpn: &[&[u8]], ) -> Result<Arc<ServerConfig>>

A rustls server config using this resolver, offering alpn and acme-tls/1.

Trait Implementations§

Source§

impl Debug for Resolver

Source§

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

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

impl Default for Resolver

Source§

fn default() -> Self

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

impl ResolvesServerCert for Resolver

Source§

fn resolve(&self, hello: ClientHello<'_>) -> Option<Arc<CertifiedKey>>

Choose a certificate chain and matching key given simplified ClientHello information. Read more
Source§

fn only_raw_public_keys(&self) -> bool

Return true when the server only supports raw public keys.

Auto Trait Implementations§

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more