pub struct AcmeConfig<EC: Debug, EA: Debug = EC> { /* private fields */ }
Expand description
Configuration for an ACME resolver.
The type parameters represent the error types for the certificate cache and account cache.
Implementations§
Source§impl AcmeConfig<Infallible, Infallible>
impl AcmeConfig<Infallible, Infallible>
Sourcepub fn new(domains: impl IntoIterator<Item = impl AsRef<str>>) -> Self
Available on crate feature webpki-roots
and (crate features ring
or aws-lc-rs
) only.
pub fn new(domains: impl IntoIterator<Item = impl AsRef<str>>) -> Self
webpki-roots
and (crate features ring
or aws-lc-rs
) only.Creates a new AcmeConfig instance with Web PKI root certificates.
The new AcmeConfig instance will initially have no cache, and its type parameters for
error types will be Infallible
since the cache cannot return an error. The methods to set
a cache will change the error types to match those returned by the supplied cache.
use rustls_acme::caches::DirCache;
let config = AcmeConfig::new(["example.com"]).cache(DirCache::new("./rustls_acme_cache"));
Due to limited support for type parameter inference in Rust (see RFC213), AcmeConfig::new is not (yet) generic over the AcmeConfig’s type parameters. An uncached instance of AcmeConfig with particular type parameters can be created using NoCache.
use rustls_acme::caches::NoCache;
let config: AcmeConfig<EC, EA> = AcmeConfig::new(["example.com"]).cache(NoCache::default());
Sourcepub fn new_with_provider(
domains: impl IntoIterator<Item = impl AsRef<str>>,
provider: Arc<CryptoProvider>,
) -> Self
Available on crate feature webpki-roots
only.
pub fn new_with_provider( domains: impl IntoIterator<Item = impl AsRef<str>>, provider: Arc<CryptoProvider>, ) -> Self
webpki-roots
only.Same as AcmeConfig::new, with a specific CryptoProvider.
Sourcepub fn new_with_client_config(
domains: impl IntoIterator<Item = impl AsRef<str>>,
client_config: Arc<ClientConfig>,
) -> Self
pub fn new_with_client_config( domains: impl IntoIterator<Item = impl AsRef<str>>, client_config: Arc<ClientConfig>, ) -> Self
Creates a new AcmeConfig instance with the provided TLS configuration client.
The new AcmeConfig instance will initially have no cache, and its type parameters for
error types will be Infallible
since the cache cannot return an error. The methods to set
a cache will change the error types to match those returned by the supplied cache.
use std::sync::Arc;
use futures_rustls::rustls::ClientConfig;
use rustls_acme::caches::DirCache;
let client_config = Arc::new(
ClientConfig::builder_with_provider(provider)
.with_safe_default_protocol_versions()
.unwrap()
.with_root_certificates(root_store)
.with_no_client_auth(),
);
let config = AcmeConfig::new_with_client_config(["example.com"], client_config)
.cache(DirCache::new("./rustls_acme_cache"));
Due to limited support for type parameter inference in Rust (see RFC213), AcmeConfig::new_with_client_config is not (yet) generic over the AcmeConfig’s type parameters. An uncached instance of AcmeConfig with particular type parameters can be created using NoCache.
use rustls_acme::caches::NoCache;
let config: AcmeConfig<EC, EA> = AcmeConfig::new_with_client_config(["example.com"], client_config)
.cache(NoCache::default());
Source§impl<EC: 'static + Debug, EA: 'static + Debug> AcmeConfig<EC, EA>
impl<EC: 'static + Debug, EA: 'static + Debug> AcmeConfig<EC, EA>
Sourcepub fn client_tls_config(self, client_config: Arc<ClientConfig>) -> Self
pub fn client_tls_config(self, client_config: Arc<ClientConfig>) -> Self
Set custom rustls::ClientConfig
for ACME API calls.
pub fn directory(self, directory_url: impl AsRef<str>) -> Self
pub fn directory_lets_encrypt(self, production: bool) -> Self
pub fn domains(self, contact: impl IntoIterator<Item = impl AsRef<str>>) -> Self
pub fn domains_push(self, contact: impl AsRef<str>) -> Self
Sourcepub fn contact(self, contact: impl IntoIterator<Item = impl AsRef<str>>) -> Self
pub fn contact(self, contact: impl IntoIterator<Item = impl AsRef<str>>) -> Self
Provide a list of contacts for the account.
Note that email addresses must include a mailto:
prefix.
Sourcepub fn contact_push(self, contact: impl AsRef<str>) -> Self
pub fn contact_push(self, contact: impl AsRef<str>) -> Self
Provide a contact for the account.
Note that an email address must include a mailto:
prefix.
pub fn cache<C: 'static + Cache>(self, cache: C) -> AcmeConfig<C::EC, C::EA>
pub fn cache_compose<CC: 'static + CertCache, CA: 'static + AccountCache>( self, cert_cache: CC, account_cache: CA, ) -> AcmeConfig<CC::EC, CA::EA>
pub fn cache_with_boxed_err<C: 'static + Cache>( self, cache: C, ) -> AcmeConfig<Box<dyn Debug>>
pub fn cache_option<C: 'static + Cache>( self, cache: Option<C>, ) -> AcmeConfig<C::EC, C::EA>
pub fn challenge_type(self, challenge_type: UseChallenge) -> Self
pub fn state(self) -> AcmeState<EC, EA>
Sourcepub fn incoming<TCP: AsyncRead + AsyncWrite + Unpin, ETCP, ITCP: Stream<Item = Result<TCP, ETCP>> + Unpin>(
self,
tcp_incoming: ITCP,
alpn_protocols: Vec<Vec<u8>>,
) -> Incoming<TCP, ETCP, ITCP, EC, EA>
pub fn incoming<TCP: AsyncRead + AsyncWrite + Unpin, ETCP, ITCP: Stream<Item = Result<TCP, ETCP>> + Unpin>( self, tcp_incoming: ITCP, alpn_protocols: Vec<Vec<u8>>, ) -> Incoming<TCP, ETCP, ITCP, EC, EA>
Turn a stream of TCP connections into a stream of TLS connections.
Specify supported protocol names in alpn_protocols
, most preferred first. If empty (Vec::new()
), we don’t do ALPN.
Sourcepub fn tokio_incoming<TokioTCP: AsyncRead + AsyncWrite + Unpin, ETCP, TokioITCP: Stream<Item = Result<TokioTCP, ETCP>> + Unpin>(
self,
tcp_incoming: TokioITCP,
alpn_protocols: Vec<Vec<u8>>,
) -> TokioIncoming<Compat<TokioTCP>, ETCP, TokioIncomingTcpWrapper<TokioTCP, ETCP, TokioITCP>, EC, EA>
Available on crate feature tokio
only.
pub fn tokio_incoming<TokioTCP: AsyncRead + AsyncWrite + Unpin, ETCP, TokioITCP: Stream<Item = Result<TokioTCP, ETCP>> + Unpin>( self, tcp_incoming: TokioITCP, alpn_protocols: Vec<Vec<u8>>, ) -> TokioIncoming<Compat<TokioTCP>, ETCP, TokioIncomingTcpWrapper<TokioTCP, ETCP, TokioITCP>, EC, EA>
tokio
only.Tokio compatible wrapper for Self::incoming.