A tokio_postgres TLS connector backed by rustls.
use rustls_tokio_postgres::{config_no_verify, MakeRustlsConnect};
use tokio_postgres::{connect, Config};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
static CONFIG: &str = "host=localhost user=postgres";
// This rustls config does not verify the server certificate.
// You can construct your own rustls ClientConfig, if needed.
let tls = MakeRustlsConnect::new(config_no_verify());
// Create the client with the TLS configuration.
let (_client, _conn) = connect(CONFIG, tls).await?;
Ok(())
}- channel-binding: enables TLS channel binding, if supported.
- native-roots: enables a function for creating a
rustls::ClientConfigusing the rustls-native-certs crate. - webpki-roots: enables a function for creating a
rustls::ClientConfigusing the webpki-roots crate.