dns_types::zones::types

Function zone_result_helper

Source
fn zone_result_helper(
    name: &DomainName,
    qtype: QueryType,
    records: &HashMap<RecordType, Vec<ZoneRecord>>,
    nsdname: &DomainName,
) -> ZoneResult
Expand description

Handles the terminal cases of step 3 of the standard nameserver algorithm. If we’re here, we’ve got a domain and records which are associated with it. The possible cases are:

  • There are NS record(s) delegating this name elsewhere, and the qtype is not exactly equal to NS. In which case we should return those. If this is a top-level non-recursive query they will be returned in the AUTHORITY section.

  • There’s a CNAME record on this name, and the qtype does not match CNAME. In which case we return a CNAME response, and the upstream resolver will then try go resolve that.

  • Otherwise, return all RRs which match the query: this answers the question.