https://github.com/ryanfowler/rustls-tokio-postgres
A tokio-postgres TLS connector backed by rustls
https://github.com/ryanfowler/rustls-tokio-postgres
Last synced: 23 days ago
JSON representation
A tokio-postgres TLS connector backed by rustls
- Host: GitHub
- URL: https://github.com/ryanfowler/rustls-tokio-postgres
- Owner: ryanfowler
- License: apache-2.0
- Created: 2025-08-16T14:14:44.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-04-04T14:51:37.000Z (27 days ago)
- Last Synced: 2026-04-04T16:59:39.269Z (27 days ago)
- Language: Rust
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rustls-tokio-postgres
[](https://crates.io/crates/rustls-tokio-postgres)
[](https://docs.rs/rustls-tokio-postgres)
[](#license)
A [`tokio_postgres`](https://crates.io/crates/tokio-postgres) TLS connector backed by [`rustls`](https://crates.io/crates/rustls).
## Example
```rust
use rustls_tokio_postgres::{config_no_verify, MakeRustlsConnect};
use tokio_postgres::{connect, Config};
#[tokio::main]
async fn main() -> Result<(), Box> {
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](./LICENSE)