pub struct DnsResolver<R>where
R: Runtime,{ /* private fields */ }Available on crate features
resolver and dns only.Expand description
A resolver which supports both domain:port and socket address.
- If you can make sure, you always play with
SocketAddr, you may want to useSocketAddrResolver. - If you do not want to send DNS queries, you may want to use
AddressResolver.
N.B. If a domain contains multiple ip addresses, there is no guarantee that
which one will be used. Users should make sure that the domain only contains
one ip address, to make sure that DnsResolver can work properly.
e.g. valid address format:
www.example.com:8080// domain[::1]:8080// ipv6127.0.0.1:8080// ipv4
Trait Implementations§
Source§impl<R> AddressResolver for DnsResolver<R>where
R: Runtime,
impl<R> AddressResolver for DnsResolver<R>where
R: Runtime,
Source§type ResolvedAddress = SocketAddr
type ResolvedAddress = SocketAddr
The address type returned by the resolver.
Source§type Options = DnsResolverOptions
type Options = DnsResolverOptions
The options type used to configure the resolver.
Source§async fn new(
opts: <DnsResolver<R> as AddressResolver>::Options,
) -> Result<DnsResolver<R>, <DnsResolver<R> as AddressResolver>::Error>where
DnsResolver<R>: Sized,
async fn new(
opts: <DnsResolver<R> as AddressResolver>::Options,
) -> Result<DnsResolver<R>, <DnsResolver<R> as AddressResolver>::Error>where
DnsResolver<R>: Sized,
Creates a new resolver with the given options.
Source§async fn resolve(
&self,
address: &<DnsResolver<R> as AddressResolver>::Address,
) -> Result<<DnsResolver<R> as AddressResolver>::ResolvedAddress, <DnsResolver<R> as AddressResolver>::Error>
async fn resolve( &self, address: &<DnsResolver<R> as AddressResolver>::Address, ) -> Result<<DnsResolver<R> as AddressResolver>::ResolvedAddress, <DnsResolver<R> as AddressResolver>::Error>
Resolves the given node address to a [
SocketAddr].Auto Trait Implementations§
impl<R> !Freeze for DnsResolver<R>
impl<R> !RefUnwindSafe for DnsResolver<R>
impl<R> Send for DnsResolver<R>
impl<R> Sync for DnsResolver<R>
impl<R> Unpin for DnsResolver<R>
impl<R> !UnwindSafe for DnsResolver<R>
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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