pub struct Resolver { /* private fields */ }Expand description
The SNI resolver. Share it as Arc<Resolver>.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub fn with_self_signed(names: &[String]) -> Result<Self>
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.
Sourcepub fn set(&self, source: Source, pair: &CertPair) -> Result<CertInfo>
pub fn set(&self, source: Source, pair: &CertPair) -> Result<CertInfo>
Installs pair from source for every DNS name in it; returns what it says.
Sourcepub fn set_key(&self, source: Source, key: Arc<CertifiedKey>, info: &CertInfo)
pub fn set_key(&self, source: Source, key: Arc<CertifiedKey>, info: &CertInfo)
Installs a built key from source for the names in info.
Sourcepub fn pin(&self, pattern: &str, pair: &CertPair) -> Result<CertInfo>
pub fn pin(&self, pattern: &str, pair: &CertPair) -> Result<CertInfo>
Pins pair for pattern (a name or *. wildcard), whatever the certificate’s names.
Sourcepub fn set_default(&self, key: Arc<CertifiedKey>, not_after: SystemTime)
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).
Sourcepub fn set_default_as(
&self,
source: Source,
key: Arc<CertifiedKey>,
not_after: SystemTime,
)
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.
Sourcepub fn set_default_pair(
&self,
source: Source,
pair: &CertPair,
) -> Result<CertInfo>
pub fn set_default_pair( &self, source: Source, pair: &CertPair, ) -> Result<CertInfo>
Makes pair from source the default certificate; returns what it says.
Sourcepub fn default_source(&self) -> Option<Source>
pub fn default_source(&self) -> Option<Source>
The default certificate’s source, if one is set.
Sourcepub fn clear_default(&self)
pub fn clear_default(&self)
Clears the default certificate.
Sourcepub fn lookup(&self, sni: Option<&str>) -> Option<(Source, Arc<CertifiedKey>)>
pub fn lookup(&self, sni: Option<&str>) -> Option<(Source, Arc<CertifiedKey>)>
The certificate and its source a handshake for sni gets now.
Sourcepub fn lookup_at(
&self,
sni: Option<&str>,
now: SystemTime,
) -> Option<(Source, Arc<CertifiedKey>)>
pub fn lookup_at( &self, sni: Option<&str>, now: SystemTime, ) -> Option<(Source, Arc<CertifiedKey>)>
Resolver::lookup at time now.
Sourcepub fn challenge_config(self: &Arc<Self>) -> Result<Arc<ServerConfig>>
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).
Sourcepub fn has_alpn(&self, name: &str) -> bool
pub fn has_alpn(&self, name: &str) -> bool
True while a TLS-ALPN-01 answer for name is published.
Sourcepub fn server_config(
self: &Arc<Self>,
alpn: &[&[u8]],
) -> Result<Arc<ServerConfig>>
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.