pub trait DnsHandle: 'static + Clone + Send + Sync + Unpin {
    type Response: Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin + 'static;
    type Error: From<ProtoError> + Error + Clone + Send + Unpin + 'static;

    // Required method
    fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(
        &mut self,
        request: R
    ) -> Self::Response;

    // Provided methods
    fn is_verifying_dnssec(&self) -> bool { ... }
    fn is_using_edns(&self) -> bool { ... }
    fn lookup(
        &mut self,
        query: Query,
        options: DnsRequestOptions
    ) -> Self::Response { ... }
}
Expand description

A trait for implementing high level functions of DNS.

Required Associated Types§

source

type Response: Stream<Item = Result<DnsResponse, Self::Error>> + Send + Unpin + 'static

The associated response from the response stream, this should resolve to the Response messages

source

type Error: From<ProtoError> + Error + Clone + Send + Unpin + 'static

Error of the response, generally this will be ProtoError

Required Methods§

source

fn send<R: Into<DnsRequest> + Unpin + Send + 'static>( &mut self, request: R ) -> Self::Response

Send a message via the channel in the client

Arguments
  • request - the fully constructed Message to send, note that most implementations of will most likely be required to rewrite the QueryId, do no rely on that as being stable.

Provided Methods§

source

fn is_verifying_dnssec(&self) -> bool

Only returns true if and only if this DNS handle is validating DNSSEC.

If the DnsHandle impl is wrapping other clients, then the correct option is to delegate the question to the wrapped client.

source

fn is_using_edns(&self) -> bool

Allow for disabling EDNS

source

fn lookup(&mut self, query: Query, options: DnsRequestOptions) -> Self::Response

A classic DNS query

This is identical to query, but instead takes a Query object.

Arguments
  • query - the query to lookup
  • options - options to use when constructing the message

Object Safety§

This trait is not object safe.

Implementors§

source§

impl DnsHandle for BufDnsRequestStreamHandle

source§

impl DnsHandle for DnsExchange

source§

impl<H> DnsHandle for DnssecDnsHandle<H>where H: DnsHandle + Sync + Unpin,

Available on crate feature dnssec only.
§

type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, <DnssecDnsHandle<H> as DnsHandle>::Error>> + Send>>

§

type Error = <H as DnsHandle>::Error

source§

impl<H> DnsHandle for RetryDnsHandle<H>where H: DnsHandle + Send + Unpin + 'static, H::Error: RetryableError,

§

type Response = Pin<Box<dyn Stream<Item = Result<DnsResponse, <RetryDnsHandle<H> as DnsHandle>::Error>> + Send + Unpin>>

§

type Error = <H as DnsHandle>::Error