Function create_postgres_tls_connector

Source
pub fn create_postgres_tls_connector(
    tls_config: &TlsOption,
) -> Result<MakeRustlsConnect>
Expand description

Creates a PostgreSQL TLS connector based on the provided configuration.

This function creates a rustls-based TLS connector for PostgreSQL connections, following PostgreSQL’s TLS mode specifications exactly:

§TLS Modes (PostgreSQL Specification)

  • Disable: No TLS connection attempted
  • Prefer: Try TLS first, fallback to plaintext if TLS fails (handled by connection logic)
  • Require: Only TLS connections, but NO certificate verification (accept any cert)
  • VerifyCa: TLS + verify certificate is signed by trusted CA (no hostname verification)
  • VerifyFull: TLS + verify CA + verify hostname matches certificate SAN