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: StringThe 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: boolTrue 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.
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: u64Wall-clock time of the main query in milliseconds.
Implementations§
Source§impl DnsQueryResult
impl DnsQueryResult
Sourcepub fn is_nodata(&self) -> bool
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).
Sourcepub fn referral_zone(&self) -> Option<&str>
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.
Sourcepub fn cname_chain(&self) -> impl Iterator<Item = &DnsRecord>
pub fn cname_chain(&self) -> impl Iterator<Item = &DnsRecord>
The CNAME records at the front of answers.
Trait Implementations§
Source§impl Clone for DnsQueryResult
impl Clone for DnsQueryResult
Source§impl Debug for DnsQueryResult
impl Debug for DnsQueryResult
Source§impl<'de> Deserialize<'de> for DnsQueryResult
impl<'de> Deserialize<'de> for DnsQueryResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for DnsQueryResult
Source§impl PartialEq for DnsQueryResult
impl PartialEq for DnsQueryResult
Source§impl Serialize for DnsQueryResult
impl Serialize for DnsQueryResult
impl StructuralPartialEq for DnsQueryResult
Auto Trait Implementations§
impl Freeze for DnsQueryResult
impl RefUnwindSafe for DnsQueryResult
impl Send for DnsQueryResult
impl Sync for DnsQueryResult
impl Unpin for DnsQueryResult
impl UnsafeUnpin for DnsQueryResult
impl UnwindSafe for DnsQueryResult
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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