rustls-letsencrypt 0.1.2

Automatic Let's Encrypt, ACME, and local-CA certificate management for rustls listeners
Documentation
use std::{io, net::AddrParseError};

use thiserror::Error;

pub type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Error)]
pub enum Error {
    #[error("the port-443 ALPN handler has not been registered")]
    AlpnHandlerNotRegistered,
    #[error("the port-443 ALPN handler is still initializing")]
    AlpnHandlerNotReady,
    #[error("an ALPN handler is already registered")]
    AlpnHandlerAlreadyRegistered,
    #[error("challenge listener is unavailable")]
    ChallengeListenerUnavailable,
    #[error("listener must bind port 443 (bound port: {0})")]
    InvalidAlpnPort(u16),
    #[error("invalid configuration: {0}")]
    InvalidConfig(String),
    #[error("invalid DNS name: {0}")]
    InvalidDnsName(String),
    #[error("hostname is not allowed: {0}")]
    HostNotAllowed(String),
    #[error("TLS ClientHello did not include SNI")]
    MissingSni,
    #[error("ClientHello timed out")]
    ClientHelloTimeout,
    #[error("TLS handshake timed out")]
    HandshakeTimeout,
    #[error("certificate issuance timed out for {0}")]
    IssuanceTimeout(String),
    #[error("no usable certificate for {0}")]
    NoCertificate(String),
    #[error("certificate validation failed: {0}")]
    Certificate(String),
    #[error("local CA validation failed: {0}")]
    LocalCa(String),
    #[error("ACME failed: {0}")]
    Acme(String),
    #[error("managed Pebble executable was not found: {0}")]
    PebbleExecutableNotFound(String),
    #[error("managed Pebble address is already in use: {0}")]
    PebbleAddressInUse(String),
    #[error("DNS ownership check failed for {host}; resolved {resolved:?}")]
    DnsOwnershipMismatch { host: String, resolved: Vec<std::net::IpAddr> },
    #[error("event subscriber lagged and lost {0} events")]
    EventLagged(u64),
    #[error(transparent)]
    Store(#[from] StoreError),
    #[error(transparent)]
    Io(#[from] io::Error),
    #[error(transparent)]
    Addr(#[from] AddrParseError),
    #[error("TLS error: {0}")]
    Tls(String),
}

#[derive(Debug, Error)]
pub enum StoreError {
    #[error("store I/O failed: {0}")]
    Io(#[from] io::Error),
    #[error("store serialization failed: {0}")]
    Serialization(#[from] serde_json::Error),
    #[error("store record is corrupt: {0}")]
    Corrupt(String),
    #[error("store compare-and-swap conflict")]
    Conflict,
    #[error("store is read-only")]
    ReadOnly,
    #[error("store operation is unsupported: {0}")]
    Unsupported(&'static str),
}