package dns

//go:generate go run duplicate_generate.go

// IsDuplicate checks of r1 and r2 are duplicates of each other, excluding the TTL.
// So this means the header data is equal *and* the RDATA is the same. Returns true
// if so, otherwise false. It's a protocol violation to have identical RRs in a message.
func (,  RR) bool {
	// Check whether the record header is identical.
	if !.Header().isDuplicate(.Header()) {
		return false
	}

	// Check whether the RDATA is identical.
	return .isDuplicate()
}

func ( *RR_Header) ( RR) bool {
	,  := .(*RR_Header)
	if ! {
		return false
	}
	if .Class != .Class {
		return false
	}
	if .Rrtype != .Rrtype {
		return false
	}
	if !isDuplicateName(.Name, .Name) {
		return false
	}
	// ignore TTL
	return true
}

// isDuplicateName checks if the domain names s1 and s2 are equal.
func isDuplicateName(,  string) bool { return equal(, ) }