Skip to main content

DnsQueryResult

Struct DnsQueryResult 

Source
pub struct DnsQueryResult {
    pub name: String,
    pub record_type: RecordType,
    pub server: Option<String>,
    pub answered_locally: bool,
    pub status: DnsStatus,
    pub flags: Vec<String>,
    pub answers: Vec<DnsRecord>,
    pub authority: Vec<DnsRecord>,
    pub failed_types: Vec<FailedType>,
    pub wildcard: Option<WildcardProbe>,
    pub query_time_ms: u64,
}
Expand description

A full DNS query result, the way dig reports it.

Built by DnsResolver::query. A negative answer is a result, not an error: NXDOMAIN, NODATA (NOERROR with no records of the type), SERVFAIL and REFUSED all come back as a DnsQueryResult with that status. An Err means there is no response to report: invalid input (a malformed name, a bare-domain SRV query), a nameserver that was refused (a private or reserved address) or did not resolve, or a transport failure (timeout, no connection).

Fields§

§name: String

The normalized name that was queried (for an IP-literal PTR query, the reverse-DNS name).

§record_type: RecordType§server: Option<String>

The nameserver spec the caller passed (as given), or None for the default upstream (Google Public DNS) — and None when no server was asked at all (answered_locally).

§answered_locally: bool

True when no query was sent: the name is under a special-use zone (RFC 6761) that the resolver answers itself — localhost, 127.in-addr.arpa and 1.0…0.ip6.arpa with loopback answers (NODATA for other types), invalid and onion with NXDOMAIN. server is then None, flags empty and wildcard None.

§status: DnsStatus§flags: Vec<String>

Header flags as dig prints them, lowercase, in dig’s order: qr aa tc rd ra ad cd — the ones the response header set, whatever its status.

Empty only for an answer no server gave (answered_locally): seer never invents flags, nor passes on the header hickory makes up for its own answer.

§answers: Vec<DnsRecord>

The ANSWER section in order: the CNAME chain first, then the records of the requested type — every record under its real owner name. MX records are ordered by preference, as resolve orders them. For ANY: all sub-query answers merged in the ANY type order, identical records deduplicated.

A negative answer lists its chain too: NXDOMAIN beside a CNAME chain means the chain’s last target does not exist (RFC 6604 §2), and NODATA that the target has no records of the type — the queried name exists, since it owns the first CNAME.

§authority: Vec<DnsRecord>

The AUTHORITY section as the server sent it: for a negative answer the SOA of the zone that gave it, when the server sent one; for a referral the NS records of the zone it refers to (referral_zone); beside an answer, whatever the server added (an authoritative server may list its zone’s NS records). An ANY answer with records carries none (see answers).

§failed_types: Vec<FailedType>

For ANY: the types whose sub-query failed — no server responded, or it could not be sent — so the merged answer says nothing about them. Empty for any other type and when every sub-query was answered (omitted from the serialized form then).

§wildcard: Option<WildcardProbe>

Wildcard probe outcome; None when the probe was not run or did not complete.

§query_time_ms: u64

Wall-clock time of the main query in milliseconds.

Implementations§

Source§

impl DnsQueryResult

Source

pub fn is_nodata(&self) -> bool

NOERROR with no answer of the requested type (for ANY: no answers at all) — the name exists, without records of the type. A referral is not NODATA (referral_zone).

Source

pub fn referral_zone(&self) -> Option<&str>

The zone this response refers the query to, when it is a referral rather than an answer: NOERROR with no answer of the requested type, the AA (authoritative) flag clear, NS records in AUTHORITY and no SOA there (RFC 2308 §2.2) — the zone is the NS records’ owner.

A server that is neither authoritative for the name nor recursive (an @server serving only a parent zone) answers this way, pointing at the servers of the zone below it. Unlike NODATA, a referral says nothing about whether the name exists. An authoritative response is never a referral, even with its own zone’s NS records in AUTHORITY beside an unfollowed CNAME.

Source

pub fn cname_chain(&self) -> impl Iterator<Item = &DnsRecord>

The CNAME records at the front of answers.

Source

pub fn records(&self) -> impl Iterator<Item = &DnsRecord>

The answers that are not part of the CNAME chain (for a CNAME query: the CNAME itself).

Trait Implementations§

Source§

impl Clone for DnsQueryResult

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DnsQueryResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DnsQueryResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for DnsQueryResult

Source§

impl PartialEq for DnsQueryResult

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for DnsQueryResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for DnsQueryResult

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more