Available on crate feature
tls-openssl
only.Expand description
Tls implementation using openssl
§Example
use axum::{routing::get, Router};
use hyper_server::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_server::bind_openssl(addr, config)
.serve(app.into_make_service())
.await
.unwrap();
}
Modules§
- future
- Future types.
Structs§
- OpenSSL
Acceptor - Represents a TLS acceptor that uses OpenSSL for cryptographic operations.
- OpenSSL
Config - Represents configuration options for an OpenSSL-based server.
Functions§
- bind_
openssl - Binds a TLS server using OpenSSL to the specified address with the given configuration.