Expand description
TLS support for tokio-postgres
via `native-tls.
§Example
use native_tls::{Certificate, TlsConnector};
use tokio_postgres_native_tls::MakeTlsConnector;
use std::fs;
let cert = fs::read("database_cert.pem").unwrap();
let cert = Certificate::from_pem(&cert).unwrap();
let connector = TlsConnector::builder()
.add_root_certificate(cert)
.build()
.unwrap();
let connector = MakeTlsConnector::new(connector);
let connect_future = tokio_postgres::connect(
"host=localhost user=postgres sslmode=require",
connector,
);
// ...
Structs§
- Make
TlsConnector - A
MakeTlsConnect
implementation using thenative-tls
crate. - TlsConnect
Future - The future returned by
TlsConnector
. - TlsConnector
- A
TlsConnect
implementation using thenative-tls
crate.