Implement ability to disable trust-dns in ClientBuilder.
This commit is contained in:
@@ -481,6 +481,27 @@ impl ClientBuilder {
|
||||
self.with_inner(move |inner| inner.use_preconfigured_tls(tls))
|
||||
}
|
||||
|
||||
/// Enables the [trust-dns](trust_dns_resolver) async resolver instead of a default threadpool using `getaddrinfo`.
|
||||
///
|
||||
/// If the `trust-dns` feature is turned on, the default option is enabled.
|
||||
///
|
||||
/// # Optional
|
||||
///
|
||||
/// This requires the optional `trust-dns` feature to be enabled
|
||||
#[cfg(feature = "trust-dns")]
|
||||
pub fn trust_dns(self, enable: bool) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.trust_dns(enable))
|
||||
}
|
||||
|
||||
/// Disables the trust-dns async resolver.
|
||||
///
|
||||
/// This method exists even if the optional `trust-dns` feature is not enabled.
|
||||
/// This can be used to ensure a `Client` doesn't use the trust-dns async resolver
|
||||
/// even if another dependency were to enable the optional `trust-dns` feature.
|
||||
pub fn no_trust_dns(self) -> ClientBuilder {
|
||||
self.with_inner(|inner| inner.no_trust_dns())
|
||||
}
|
||||
|
||||
// private
|
||||
|
||||
fn with_inner<F>(mut self, func: F) -> ClientBuilder
|
||||
|
||||
Reference in New Issue
Block a user