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
MakeTlsConnectimplementation using thenative-tlscrate. - TlsConnect
Future - The future returned by
TlsConnector. - TlsConnector
- A
TlsConnectimplementation using thenative-tlscrate.