pub struct DnsBuilder { /* private fields */ }Expand description
Fluent builder for DnsConfig.
Implementations§
Source§impl DnsBuilder
impl DnsBuilder
Sourcepub fn block_domain(self, domain: impl Into<String>) -> Self
pub fn block_domain(self, domain: impl Into<String>) -> Self
Block a specific domain via DNS interception (returns REFUSED).
Accepts any string-like input. The string is stored raw and
parsed via DomainName at Self::build time. Invalid
names accumulate as
BuildError::InvalidBlockedDomain and surface from the
outermost .build() in the chain — the chain itself stays
infallible (no ? per call).
Sourcepub fn block_domain_suffix(self, suffix: impl Into<String>) -> Self
pub fn block_domain_suffix(self, suffix: impl Into<String>) -> Self
Block a domain suffix via DNS interception (returns REFUSED).
Same string-input + lazy-parse + accumulate behavior as
Self::block_domain. Invalid suffixes accumulate as
BuildError::InvalidBlockedDomainSuffix.
Sourcepub fn rebind_protection(self, enabled: bool) -> Self
pub fn rebind_protection(self, enabled: bool) -> Self
Enable or disable DNS rebinding protection. Default: true.
Sourcepub fn nameservers<I>(self, nameservers: I) -> Self
pub fn nameservers<I>(self, nameservers: I) -> Self
Set the upstream nameservers to forward queries to. When one or
more are set, the interceptor uses these instead of the
nameservers in the host’s /etc/resolv.conf. Replaces any
previously-set nameservers. Each element is any type convertible
into Nameserver (SocketAddr, IpAddr, or a parsed
string via "dns.google:53".parse::<Nameserver>()?).
Sourcepub fn query_timeout_ms(self, ms: u64) -> Self
pub fn query_timeout_ms(self, ms: u64) -> Self
Set the per-DNS-query timeout in milliseconds. Default: 5000.
Sourcepub fn build(self) -> Result<DnsConfig, BuildError>
pub fn build(self) -> Result<DnsConfig, BuildError>
Consume the builder and return the configuration.
Surfaces the first parse error accumulated by block_domain /
block_domain_suffix (or any future lazy-parse method on this
builder). Successful chains return the populated DnsConfig.