Skip to content

Commit

Permalink
Add resolver methods for SOA and NS records
Browse files Browse the repository at this point in the history
These are useful if you want to use the resolver to retrieve:

- The domain master address, to know where to send DNS UPDATE
  messages to.
- The authoritative nameservers for a domain, to monitor them for the
  propagation of an update.
  • Loading branch information
rotty authored and bluejekyll committed Oct 18, 2019
1 parent 0bfabbd commit 10541a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/resolver/src/async_resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ impl AsyncResolver {
lookup_fn!(ipv4_lookup, lookup::Ipv4LookupFuture, RecordType::A);
lookup_fn!(ipv6_lookup, lookup::Ipv6LookupFuture, RecordType::AAAA);
lookup_fn!(mx_lookup, lookup::MxLookupFuture, RecordType::MX);
lookup_fn!(ns_lookup, lookup::NsLookupFuture, RecordType::NS);
lookup_fn!(soa_lookup, lookup::SoaLookupFuture, RecordType::SOA);
#[deprecated(note = "use lookup_srv instead, this interface is not ideal")]
lookup_fn!(srv_lookup, lookup::SrvLookupFuture, RecordType::SRV);
lookup_fn!(txt_lookup, lookup::TxtLookupFuture, RecordType::TXT);
Expand Down
16 changes: 16 additions & 0 deletions crates/resolver/src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,22 @@ lookup_type!(
RData::TXT,
rdata::TXT
);
lookup_type!(
SoaLookup,
SoaLookupIter,
SoaLookupIntoIter,
SoaLookupFuture,
RData::SOA,
rdata::SOA
);
lookup_type!(
NsLookup,
NsLookupIter,
NsLookupIntoIter,
NsLookupFuture,
RData::NS,
Name
);

#[cfg(test)]
pub mod tests {
Expand Down
2 changes: 2 additions & 0 deletions crates/resolver/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ impl Resolver {
lookup_fn!(ipv4_lookup, lookup::Ipv4Lookup);
lookup_fn!(ipv6_lookup, lookup::Ipv6Lookup);
lookup_fn!(mx_lookup, lookup::MxLookup);
lookup_fn!(ns_lookup, lookup::NsLookup);
lookup_fn!(soa_lookup, lookup::SoaLookup);
#[deprecated(note = "use lookup_srv instead, this interface is not ideal")]
lookup_fn!(srv_lookup, lookup::SrvLookup);
lookup_fn!(txt_lookup, lookup::TxtLookup);
Expand Down

0 comments on commit 10541a1

Please sign in to comment.