pub struct HostAddrResolver<R> { /* private fields */ }Expand description
A resolver which supports both domain:port and socket address. However,
it will only use ToSocketAddrs
to resolve the address.
- If you can make sure, you always play with
SocketAddr, you may want to useSocketAddrResolver. - If you want to send DNS queries, you may want to use
DnsResolver.
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 AddressResolver can work properly.
e.g. valid address format:
www.example.com:8080// domain[::1]:8080// ipv6127.0.0.1:8080// ipv4
Implementations§
Source§impl<R> HostAddrResolver<R>
impl<R> HostAddrResolver<R>
Sourcepub fn new(opts: HostAddrResolverOptions) -> HostAddrResolver<R>
pub fn new(opts: HostAddrResolverOptions) -> HostAddrResolver<R>
Create a new HostAddrResolver with the given options.
Trait Implementations§
Source§impl<R> AddressResolver for HostAddrResolver<R>where
R: RuntimeLite,
impl<R> AddressResolver for HostAddrResolver<R>where
R: RuntimeLite,
Source§type ResolvedAddress = SocketAddr
type ResolvedAddress = SocketAddr
The address type returned by the resolver.
Source§type Options = HostAddrResolverOptions
type Options = HostAddrResolverOptions
The options type used to configure the resolver.
Source§async fn new(
opts: <HostAddrResolver<R> as AddressResolver>::Options,
) -> Result<HostAddrResolver<R>, <HostAddrResolver<R> as AddressResolver>::Error>
async fn new( opts: <HostAddrResolver<R> as AddressResolver>::Options, ) -> Result<HostAddrResolver<R>, <HostAddrResolver<R> as AddressResolver>::Error>
Creates a new resolver with the given options.
Source§async fn resolve(
&self,
address: &<HostAddrResolver<R> as AddressResolver>::Address,
) -> Result<SocketAddr, <HostAddrResolver<R> as AddressResolver>::Error>
async fn resolve( &self, address: &<HostAddrResolver<R> as AddressResolver>::Address, ) -> Result<SocketAddr, <HostAddrResolver<R> as AddressResolver>::Error>
Resolves the given node address to a [
SocketAddr].Source§impl<R> Default for HostAddrResolver<R>
impl<R> Default for HostAddrResolver<R>
Source§fn default() -> HostAddrResolver<R>
fn default() -> HostAddrResolver<R>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<R> !Freeze for HostAddrResolver<R>
impl<R> !RefUnwindSafe for HostAddrResolver<R>
impl<R> Send for HostAddrResolver<R>where
R: Send,
impl<R> Sync for HostAddrResolver<R>where
R: Sync,
impl<R> Unpin for HostAddrResolver<R>where
R: Unpin,
impl<R> UnsafeUnpin for HostAddrResolver<R>
impl<R> !UnwindSafe for HostAddrResolver<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