Rust

resolver

Module

Looking a query up in a zone: exact names, wildcards, CNAMEs, delegations and negative answers.

Contents

use utopia_dns::zone::resolver::lookup;
Rust
pub fn lookup(query: &Message, zone: &Zone) -> Result<Message, Error>

Answers query from zone, shuffling multi-record answers with a generator seeded from the operating system.

See lookup_with.

use utopia_dns::zone::resolver::lookup_with;
Rust
pub fn lookup_with(query: &Message, zone: &Zone, rng: &mut Mt19937) -> Result<Message, Error>

Answers query from zone (the algorithm of https://www.usenix.org/sites/default/files/styles/article_embedded/public/tree.png):

  • no question: FORMERR;
  • records named exactly like the question: the records of its type (shuffled, RFC 2181 §5), else its CNAMEs, else no data with the SOA; a name with NS records below the apex is a referral to them;
  • otherwise the closest enclosing wildcard's records, renamed to the question's name, chosen the same way;
  • otherwise NXDOMAIN with the SOA (an SOA question at the apex is answered with it).