dns_resolver::util::types

Function prioritising_merge

Source
pub fn prioritising_merge(
    priority: &mut Vec<ResourceRecord>,
    new: Vec<ResourceRecord>,
)
Expand description

Merge two sets of RRs, where records from the second set are included if and only if there are no records of matching (name, type) in the first set.

For example, if the first set is:

example.com. 300 IN A 1.1.1.1
example.com. 300 IN A 2.2.2.2

And the second set is:

example.com. 300 IN A 3.3.3.3
example.net. 300 IN A 3.3.3.3
example.com. 300 IN MX mail.example.com.

Then the output will be:

example.com. 300 IN A 1.1.1.1
example.com. 300 IN A 2.2.2.2
example.net. 300 IN A 3.3.3.3
example.com. 300 IN MX mail.example.com.

Where the A records for example.com. have been dropped. The first set acts as an override of the second.