Expand description
Tls implementation using [rustls].
Vendored with changes from https://github.com/programatik29/axum-server/blob/master/src/tls_rustls/mod.rs
§Example
use axum::{routing::get, Router};
use axum_server::tls_rustls::RustlsConfig;
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(|| async { "Hello, world!" }));
let config = RustlsConfig::from_pem_file(
"tls_rustls_vendored/fixtures/cert.pem",
"tls_rustls_vendored/fixtures/key.pem",
)
.await
.unwrap();
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("listening on {}", addr);
axum_server::bind_rustls(addr, config)
.serve(app.into_make_service())
.await
.unwrap();
}Structs§
- Rustls
Config - Rustls configuration.