@@ -195,6 +195,7 @@ pub struct Config {
195
195
pub ( crate ) target_session_attrs : TargetSessionAttrs ,
196
196
pub ( crate ) channel_binding : ChannelBinding ,
197
197
pub ( crate ) replication_mode : Option < ReplicationMode > ,
198
+ pub ( crate ) tls_verify_host : Option < String > ,
198
199
}
199
200
200
201
impl Default for Config {
@@ -230,6 +231,7 @@ impl Config {
230
231
target_session_attrs : TargetSessionAttrs :: Any ,
231
232
channel_binding : ChannelBinding :: Prefer ,
232
233
replication_mode : None ,
234
+ tls_verify_host : None ,
233
235
}
234
236
}
235
237
@@ -373,6 +375,19 @@ impl Config {
373
375
& self . host
374
376
}
375
377
378
+ /// Sets the hostname used during TLS certificate verification, if enabled.
379
+ ///
380
+ /// This can be useful if you are connecting through an SSH tunnel.
381
+ pub fn tls_verify_host ( & mut self , host : & str ) -> & mut Config {
382
+ self . tls_verify_host = Some ( host. to_string ( ) ) ;
383
+ self
384
+ }
385
+
386
+ /// Gets the host that has been added to the configuration with `tls_verify_host`.
387
+ pub fn get_tls_verify_host ( & self ) -> Option < & str > {
388
+ self . tls_verify_host . as_deref ( )
389
+ }
390
+
376
391
/// Adds a Unix socket host to the configuration.
377
392
///
378
393
/// Unlike `host`, this method allows non-UTF8 paths.
0 commit comments