[][src]Trait embedded_nal::Dns

pub trait Dns {
    type Error: Debug;
    pub fn gethostbyname(
        &self,
        hostname: &str,
        addr_type: AddrType
    ) -> Result<IpAddr, Self::Error>;
pub fn gethostbyaddr(
        &self,
        addr: IpAddr
    ) -> Result<String<U256>, Self::Error>; }

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).

Associated Types

type Error: Debug[src]

The type returned when we have an error

Loading content...

Required methods

pub fn gethostbyname(
    &self,
    hostname: &str,
    addr_type: AddrType
) -> Result<IpAddr, Self::Error>
[src]

Resolve the first ip address of a host, given its hostname and a desired address record type to look for

pub fn gethostbyaddr(&self, addr: IpAddr) -> Result<String<U256>, Self::Error>[src]

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

Loading content...

Implementors

Loading content...