1package dns
2
3//go:generate go run duplicate_generate.go
4
5// IsDuplicate checks of r1 and r2 are duplicates of each other, excluding the TTL.
6// So this means the header data is equal *and* the RDATA is the same. Return true
7// is so, otherwise false.
8// It's is a protocol violation to have identical RRs in a message.
9func IsDuplicate(r1, r2 RR) bool {
10	if r1.Header().Class != r2.Header().Class {
11		return false
12	}
13	if r1.Header().Rrtype != r2.Header().Rrtype {
14		return false
15	}
16	if !isDulicateName(r1.Header().Name, r2.Header().Name) {
17		return false
18	}
19	// ignore TTL
20
21	return isDuplicateRdata(r1, r2)
22}
23
24// isDulicateName checks if the domain names s1 and s2 are equal.
25func isDulicateName(s1, s2 string) bool { return equal(s1, s2) }
26