dns_resolver::recursive

Function follow_cnames

Source
fn follow_cnames(
    rrs: &[ResourceRecord],
    target: &DomainName,
    qtype: QueryType,
) -> Option<(DomainName, HashMap<DomainName, DomainName>)>
Expand description

Given a set of RRs and a domain name we’re looking for, follow CNAMEs in the response and return the final name (which is the name that will have the non-CNAME records associated with it).

Returns None if CNAMEs form a loop, or there is no RR which matches the target name (a CNAME or one with the right type).