Trait embedded_nal_async::Dns
source · [−]pub trait Dns {
type Error: Debug;
type GetHostByNameFuture<'m>: Future<Output = Result<IpAddr, Self::Error>>
where
Self: 'm;
type GetHostByAddressFuture<'m>: Future<Output = Result<String<256>, Self::Error>>
where
Self: 'm;
fn get_host_by_name<'m>(
&'m self,
host: &'m str,
addr_type: AddrType
) -> Self::GetHostByNameFuture<'m>;
fn get_host_by_address<'m>(
&'m self,
addr: IpAddr
) -> Self::GetHostByAddressFuture<'m>;
}Expand description
This trait is an extension trait for TcpStack and UdpStack for dns
resolutions. It does not handle every DNS record type, but is meant as an
embedded alternative to ToSocketAddrs, and is as such meant to resolve
an ip address from a hostname, or a hostname from an ip address. This means
that it only deals in host address records A (IPv4) and AAAA (IPv6).
Required Associated Types
Future for get_host_by_name
Required Methods
fn get_host_by_name<'m>(
&'m self,
host: &'m str,
addr_type: AddrType
) -> Self::GetHostByNameFuture<'m>
fn get_host_by_name<'m>(
&'m self,
host: &'m str,
addr_type: AddrType
) -> Self::GetHostByNameFuture<'m>
Resolve the first ip address of a host, given its hostname and a desired address record type to look for
fn get_host_by_address<'m>(
&'m self,
addr: IpAddr
) -> Self::GetHostByAddressFuture<'m>
fn get_host_by_address<'m>(
&'m self,
addr: IpAddr
) -> Self::GetHostByAddressFuture<'m>
Resolve the hostname of a host, given its ip address
Note: A fully qualified domain name (FQDN), has a maximum length of
255 bytes rfc1035