Crate postgres_openssl

source ·
Expand description

TLS support for tokio-postgres and postgres via openssl.

§Examples

use openssl::ssl::{SslConnector, SslMethod};
use postgres_openssl::MakeTlsConnector;

let mut builder = SslConnector::builder(SslMethod::tls())?;
builder.set_ca_file("database_cert.pem")?;
let connector = MakeTlsConnector::new(builder.build());

let connect_future = tokio_postgres::connect(
    "host=localhost user=postgres sslmode=require",
    connector,
);

// ...
use openssl::ssl::{SslConnector, SslMethod};
use postgres_openssl::MakeTlsConnector;

let mut builder = SslConnector::builder(SslMethod::tls())?;
builder.set_ca_file("database_cert.pem")?;
let connector = MakeTlsConnector::new(builder.build());

let client = postgres::Client::connect(
    "host=localhost user=postgres sslmode=require",
    connector,
)?;

// ...

Structs§