Skip to content

ryanfowler/rustls-tokio-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustls-tokio-postgres

Crates.io Docs.rs License

A tokio_postgres TLS connector backed by rustls.

Example

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(())
}

Features

  • channel-binding: enables TLS channel binding, if supported.
  • native-roots: enables a function for creating a rustls::ClientConfig using the rustls-native-certs crate.
  • webpki-roots: enables a function for creating a rustls::ClientConfig using the webpki-roots crate.

License

Apache-2.0

About

A tokio-postgres TLS connector backed by rustls

Resources

License

Stars

Watchers

Forks

Languages