pub trait Lookup: Send + Sync {
// Required methods
fn lookup_a<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv4Addr>>> + Send + 'async_trait>>
where Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait;
fn lookup_aaaa<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv6Addr>>> + Send + 'async_trait>>
where Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait;
fn lookup_mx<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>
where Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait;
fn lookup_txt<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait;
fn lookup_ptr<'lookup, 'async_trait>(
&'lookup self,
ip: IpAddr
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>
where Self: 'async_trait,
'lookup: 'async_trait;
}
Expand description
A trait for entities that perform DNS resolution.
This trait uses the Name
type in arguments and return values. See the
documentation of this type for a discussion of its design and use.
An implementation of this trait for the Hickory DNS TokioAsyncResolver
is
available when the feature hickory-resolver
is enabled.
Lookup
is not a general purpose DNS resolver. It is a simplistic
ad-hoc model for performing DNS resolution as used in the SPF protocol.
Required Methods§
sourcefn lookup_a<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv4Addr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
fn lookup_a<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv4Addr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
Looks up the IPv4 addresses for the given name.
§Errors
If the lookup encounters an error, a LookupError
variant is returned.
sourcefn lookup_aaaa<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv6Addr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
fn lookup_aaaa<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Ipv6Addr>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
Looks up the IPv6 addresses for the given name.
§Errors
If the lookup encounters an error, a LookupError
variant is returned.
sourcefn lookup_mx<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
fn lookup_mx<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
Looks up the mail exchanger names for the given name.
Implementers may want to order the returned vector by MX preference.
§Errors
If the lookup encounters an error, a LookupError
variant is returned.
sourcefn lookup_txt<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
fn lookup_txt<'lookup, 'a, 'async_trait>(
&'lookup self,
name: &'a Name
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
'a: 'async_trait,
Looks up the text records for the given name.
Implementers should make sure that invalid UTF-8 does not cause the lookup to fail (eg, using a lossy transformation). A record consisting of multiple elements should be returned as one string, with elements joined without a separator.
§Errors
If the lookup encounters an error, a LookupError
variant is returned.
sourcefn lookup_ptr<'lookup, 'async_trait>(
&'lookup self,
ip: IpAddr
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
fn lookup_ptr<'lookup, 'async_trait>(
&'lookup self,
ip: IpAddr
) -> Pin<Box<dyn Future<Output = LookupResult<Vec<Name>>> + Send + 'async_trait>>where
Self: 'async_trait,
'lookup: 'async_trait,
Looks up the names for the given address (reverse lookup).
§Errors
If the lookup encounters an error, a LookupError
variant is returned.