pub struct DnsResolver { /* private fields */ }Expand description
A DNS-backed resolver with a TTL-respecting cache.
Implementations§
Source§impl DnsResolver
impl DnsResolver
Sourcepub fn from_system() -> Result<Self>
pub fn from_system() -> Result<Self>
A resolver using the system’s configured nameservers.
Sourcepub fn with_config(
config: ResolverConfig,
options: ResolverOpts,
) -> Result<Self>
pub fn with_config( config: ResolverConfig, options: ResolverOpts, ) -> Result<Self>
A resolver pointed at specific nameservers.
This is what makes the tests possible: they run a fixture DNS server on localhost and point sipx at it, rather than asking the public internet and hoping.
Sourcepub fn for_nameserver(server: SocketAddr, timeout: Duration) -> Result<Self>
pub fn for_nameserver(server: SocketAddr, timeout: Duration) -> Result<Self>
A resolver pointed at one nameserver.
Wraps the DNS client’s own configuration types so they appear in exactly one place. They change shape between releases — this file has been through one such change already — and a caller of sipx should not have to track that to point a resolver somewhere.
Sourcepub fn with_max_ttl(self, max_ttl: Duration) -> Self
pub fn with_max_ttl(self, max_ttl: Duration) -> Self
Cap how long any record is held, however long its TTL claims.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DnsResolver
impl !RefUnwindSafe for DnsResolver
impl Send for DnsResolver
impl Sync for DnsResolver
impl Unpin for DnsResolver
impl UnsafeUnpin for DnsResolver
impl !UnwindSafe for DnsResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more