diff --git a/postgres-native-tls/src/lib.rs b/postgres-native-tls/src/lib.rs index c599165a1..9ee7da653 100644 --- a/postgres-native-tls/src/lib.rs +++ b/postgres-native-tls/src/lib.rs @@ -185,6 +185,6 @@ where /// Set ALPN for `TlsConnectorBuilder` /// /// This is required when using `sslnegotiation=direct` -pub fn set_postgresql_alpn(builder: &mut TlsConnectorBuilder) -> &mut TlsConnectorBuilder { - builder.request_alpns(&["postgresql"]) +pub fn set_postgresql_alpn(builder: &mut TlsConnectorBuilder) { + builder.request_alpns(&["postgresql"]); } diff --git a/postgres/src/config.rs b/postgres/src/config.rs index 8c4949825..ae710d16b 100644 --- a/postgres/src/config.rs +++ b/postgres/src/config.rs @@ -41,6 +41,7 @@ use tokio_postgres::{Error, Socket}; /// can be specified, separated by commas. Each host will be tried in turn when connecting. Required if connecting /// with the `connect` method. /// * `sslnegotiation` - TLS negotiation method. If set to `direct`, the client will perform direct TLS handshake, this only works for PostgreSQL 17 and newer. +/// Note that you will need to setup ALPN of TLS client configuration to `postgresql` when using direct TLS. /// If set to `postgres`, the default value, it follows original postgres wire protocol to perform the negotiation. /// * `hostaddr` - Numeric IP address of host to connect to. This should be in the standard IPv4 address format, /// e.g., 172.28.40.9. If your machine supports IPv6, you can also use those addresses. diff --git a/tokio-postgres/src/config.rs b/tokio-postgres/src/config.rs index 41ce09abe..d618e0ad3 100644 --- a/tokio-postgres/src/config.rs +++ b/tokio-postgres/src/config.rs @@ -117,6 +117,7 @@ pub enum Host { /// can be specified, separated by commas. Each host will be tried in turn when connecting. Required if connecting /// with the `connect` method. /// * `sslnegotiation` - TLS negotiation method. If set to `direct`, the client will perform direct TLS handshake, this only works for PostgreSQL 17 and newer. +/// Note that you will need to setup ALPN of TLS client configuration to `postgresql` when using direct TLS. /// If set to `postgres`, the default value, it follows original postgres wire protocol to perform the negotiation. /// * `hostaddr` - Numeric IP address of host to connect to. This should be in the standard IPv4 address format, /// e.g., 172.28.40.9. If your machine supports IPv6, you can also use those addresses.