Struct Resolver
pub struct Resolver<P>where
P: ConnectionProvider,{ /* private fields */ }Expand description
An asynchronous resolver for DNS generic over async Runtimes.
The lookup methods on Resolver spawn background tasks to perform
queries. The futures returned by a Resolver and the corresponding
background tasks need not be spawned on the same executor, or be in the
same thread.
NOTE If lookup futures returned by a Resolver and the background
tasks are spawned on two separate CurrentThread executors, one thread
cannot run both executors simultaneously, so the run or block_on
functions will cause the thread to deadlock. If both the background work
and the lookup futures are intended to be run on the same thread, they
should be spawned on the same executor.
Implementations§
§impl Resolver<TokioRuntimeProvider>
impl Resolver<TokioRuntimeProvider>
pub fn builder_tokio() -> Result<ResolverBuilder<TokioRuntimeProvider>, NetError>
pub fn builder_tokio() -> Result<ResolverBuilder<TokioRuntimeProvider>, NetError>
Constructs a new Tokio based Resolver with the system configuration.
This will use /etc/resolv.conf on Unix OSes and the registry on Windows.
§impl<R> Resolver<R>where
R: ConnectionProvider,
impl<R> Resolver<R>where
R: ConnectionProvider,
pub fn builder(provider: R) -> Result<ResolverBuilder<R>, NetError>
pub fn builder(provider: R) -> Result<ResolverBuilder<R>, NetError>
Constructs a new Resolver via ResolverBuilder with the operating system’s
configuration.
To use this with Tokio, see TokioResolver::builder_tokio instead.
This will use /etc/resolv.conf on Unix OSes and the registry on Windows.
pub fn builder_with_config(
config: ResolverConfig,
provider: R,
) -> ResolverBuilder<R>
pub fn builder_with_config( config: ResolverConfig, provider: R, ) -> ResolverBuilder<R>
Construct a new Resolver via ResolverBuilder with the provided configuration.
pub async fn lookup(
&self,
name: impl IntoName,
record_type: RecordType,
) -> Result<Lookup, NetError>
pub async fn lookup( &self, name: impl IntoName, record_type: RecordType, ) -> Result<Lookup, NetError>
Generic lookup for any RecordType
WARNING this interface may change in the future, see if one of the specializations would be better.
§Arguments
name- name of the record to lookup, if name is not a valid domain name, an error will be returnedrecord_type- type of record to lookup, all RecordData responses will be filtered to this type
§Returns
pub async fn lookup_ip(&self, host: impl IntoName) -> Result<LookupIp, NetError>
pub async fn lookup_ip(&self, host: impl IntoName) -> Result<LookupIp, NetError>
Performs a dual-stack DNS lookup for the IP for the given hostname.
See the configuration and options parameters for controlling the way in which A(Ipv4) and AAAA(Ipv6) lookups will be performed. For the least expensive query a fully-qualified-domain-name, FQDN, which ends in a final ., e.g. www.example.com., will only issue one query. Anything else will always incur the cost of querying the ResolverConfig::domain and ResolverConfig::search.
§Arguments
host- string hostname, if this is an invalid hostname, an error will be returned.
pub fn clear_lookup_cache(&self, name: impl IntoName, record_type: RecordType)
pub fn clear_lookup_cache(&self, name: impl IntoName, record_type: RecordType)
Clear the cache for a specific lookup
§Arguments
name- name of the record to clearrecord_type- type of record to clear
pub async fn reverse_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn reverse_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn ipv4_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn ipv4_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn ipv6_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn ipv6_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn mx_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
pub async fn mx_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn ns_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
pub async fn ns_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn smimea_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn smimea_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn soa_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
pub async fn soa_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn srv_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
pub async fn srv_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn tlsa_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn tlsa_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn txt_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
pub async fn txt_lookup(&self, query: impl IntoName) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub async fn cert_lookup(
&self,
query: impl IntoName,
) -> Result<Lookup, NetError>
pub async fn cert_lookup( &self, query: impl IntoName, ) -> Result<Lookup, NetError>
Performs a lookup for the associated type.
hint queries that end with a ‘.’ are fully qualified names and are cheaper lookups
§Arguments
query- a string which parses to a domain name, failure to parse will return an error
pub fn clear_cache(&self)
pub fn clear_cache(&self)
Flushes/Removes all entries from the cache
pub fn options(&self) -> &ResolverOpts
pub fn options(&self) -> &ResolverOpts
Read the options for this resolver.
Trait Implementations§
§impl<P> Clone for Resolver<P>where
P: Clone + ConnectionProvider,
impl<P> Clone for Resolver<P>where
P: Clone + ConnectionProvider,
§impl<P> Debug for Resolver<P>where
P: ConnectionProvider,
impl<P> Debug for Resolver<P>where
P: ConnectionProvider,
§impl From<Resolver<TokioRuntimeProvider>> for HickoryDnsResolver
impl From<Resolver<TokioRuntimeProvider>> for HickoryDnsResolver
§fn from(value: Resolver<TokioRuntimeProvider>) -> HickoryDnsResolver
fn from(value: Resolver<TokioRuntimeProvider>) -> HickoryDnsResolver
Auto Trait Implementations§
impl<P> Freeze for Resolver<P>
impl<P> !RefUnwindSafe for Resolver<P>
impl<P> Send for Resolver<P>
impl<P> Sync for Resolver<P>
impl<P> Unpin for Resolver<P>
impl<P> UnsafeUnpin for Resolver<P>
impl<P> !UnwindSafe for Resolver<P>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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> ⓘ
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> ⓘ
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more