Module hyper_serve::tls_openssl
source · Available on crate feature
tls-openssl
only.Expand description
Tls implementation using openssl
§Example
use axum::{routing::get, Router};
use hyper_serve::tls_openssl::OpenSSLConfig;
use std::net::SocketAddr;
#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(|| async { "Hello, world!" }));
let config = OpenSSLConfig::from_pem_file(
"examples/self-signed-certs/cert.pem",
"examples/self-signed-certs/key.pem",
)
.unwrap();
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
println!("listening on {}", addr);
hyper_serve::bind_openssl(addr, config)
.serve(app.into_make_service())
.await
.unwrap();
}
Modules§
- Future types.
Structs§
- Tls acceptor that uses OpenSSL. For details on how to use this see
crate::tls_openssl
module for more details. - OpenSSL configuration.
Functions§
- Create a TLS server that will be bound to the provided socket with a configuration. See the
crate::tls_openssl
module for more details.