Module salvo_core::conn::acme

source ·
Available on crate feature acme only.
Expand description

ACME supports.

Reference: https://datatracker.ietf.org/doc/html/rfc8555 Reference: https://datatracker.ietf.org/doc/html/rfc8737

  • HTTP-01

§Example

use salvo_core::prelude::*;

#[handler]
async fn hello() -> &'static str {
    "Hello World"
}

#[tokio::main]
async fn main() {
    let mut router = Router::new().get(hello);
    let listener = TcpListener::new("0.0.0.0:443")
        .acme()
        // .directory("letsencrypt", salvo::conn::acme::LETS_ENCRYPT_STAGING)
        .cache_path("acme/letsencrypt")
        .add_domain("acme-http01.salvo.rs")
        .http01_challege(&mut router);
    let acceptor = listener.join(TcpListener::new("0.0.0.0:80")).bind().await;
    Server::new(acceptor).serve(router).await;
}
  • TLS ALPN-01

§Example

use salvo_core::prelude::*;

#[handler]
async fn hello() -> &'static str {
    "Hello World"
}

#[tokio::main]
async fn main() {
    let router = Router::new().get(hello);
    let acceptor = TcpListener::new("0.0.0.0:443")
        .acme()
        // .directory("letsencrypt", salvo::conn::acme::LETS_ENCRYPT_STAGING)
        .cache_path("acme/letsencrypt")
        .add_domain("acme-tls-alpn01.salvo.rs")
        .bind().await;
    Server::new(acceptor).serve(router).await;
}

Modules§

  • Ways to cache account data and certificates. A default implementation for AsRef<Path> (Sting, OsString, PathBuf, …) allows the use of a local directory as cache. Note that the files contain private keys.

Structs§

Enums§

Constants§