mongodb/client/options/
resolver_config.rs

1#[cfg(feature = "dns-resolver")]
2use hickory_resolver::config::ResolverConfig as HickoryResolverConfig;
3
4/// Configuration for the upstream nameservers to use for resolution.
5///
6/// This is a thin wrapper around a `hickory_resolver::config::ResolverConfig` provided to ensure
7/// API stability.
8#[derive(Clone, Debug, PartialEq)]
9pub struct ResolverConfig {
10    #[cfg(feature = "dns-resolver")]
11    pub(crate) inner: HickoryResolverConfig,
12}
13
14#[cfg(feature = "dns-resolver")]
15impl ResolverConfig {
16    /// Creates a default configuration, using 1.1.1.1, 1.0.0.1 and 2606:4700:4700::1111,
17    /// 2606:4700:4700::1001 (thank you, Cloudflare).
18    ///
19    /// Please see: <https://www.cloudflare.com/dns/>
20    pub fn cloudflare() -> Self {
21        ResolverConfig {
22            inner: HickoryResolverConfig::cloudflare(),
23        }
24    }
25
26    /// Creates a default configuration, using 8.8.8.8, 8.8.4.4 and 2001:4860:4860::8888,
27    /// 2001:4860:4860::8844 (thank you, Google).
28    ///
29    /// Please see Google’s privacy statement for important information about what they track, many
30    /// ISP’s track similar information in DNS.
31    pub fn google() -> Self {
32        ResolverConfig {
33            inner: HickoryResolverConfig::google(),
34        }
35    }
36
37    /// Creates a configuration, using 9.9.9.9, 149.112.112.112 and 2620:fe::fe, 2620:fe::fe:9, the
38    /// “secure” variants of the quad9 settings (thank you, Quad9).
39    ///
40    /// Please see: <https://www.quad9.net/faq/>
41    pub fn quad9() -> Self {
42        ResolverConfig {
43            inner: HickoryResolverConfig::quad9(),
44        }
45    }
46}