[][src]Crate tokio_postgres_native_tls

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

MakeTlsConnector

A MakeTlsConnect implementation using the native-tls crate.

TlsConnectFuture

The future returned by TlsConnector.

TlsConnector

A TlsConnect implementation using the native-tls crate.