dns/zduplicate.go

1341 lines
20 KiB
Go
Raw Normal View History

// Code generated by "go run duplicate_generate.go"; DO NOT EDIT.
package dns
// isDuplicate() functions
func (r1 *A) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*A)
if !ok {
return false
}
_ = r2
if !r1.A.Equal(r2.A) {
return false
}
return true
}
func (r1 *AAAA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*AAAA)
if !ok {
return false
}
_ = r2
if !r1.AAAA.Equal(r2.AAAA) {
return false
}
return true
}
func (r1 *AFSDB) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*AFSDB)
if !ok {
return false
}
_ = r2
if r1.Subtype != r2.Subtype {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Hostname, r2.Hostname) {
return false
}
return true
}
func (r1 *ANY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*ANY)
if !ok {
return false
}
_ = r2
return true
}
func (r1 *APL) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*APL)
if !ok {
return false
}
_ = r2
if len(r1.Prefixes) != len(r2.Prefixes) {
return false
}
for i := 0; i < len(r1.Prefixes); i++ {
if !r1.Prefixes[i].equals(&r2.Prefixes[i]) {
return false
}
}
return true
}
func (r1 *AVC) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*AVC)
if !ok {
return false
}
_ = r2
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func (r1 *CAA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CAA)
if !ok {
return false
}
_ = r2
if r1.Flag != r2.Flag {
return false
}
if r1.Tag != r2.Tag {
return false
}
if r1.Value != r2.Value {
return false
}
return true
}
func (r1 *CDNSKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CDNSKEY)
if !ok {
return false
}
_ = r2
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func (r1 *CDS) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CDS)
if !ok {
return false
}
_ = r2
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func (r1 *CERT) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CERT)
if !ok {
return false
}
_ = r2
if r1.Type != r2.Type {
return false
}
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func (r1 *CNAME) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CNAME)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Target, r2.Target) {
return false
}
return true
}
func (r1 *CSYNC) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*CSYNC)
if !ok {
return false
}
_ = r2
if r1.Serial != r2.Serial {
return false
}
if r1.Flags != r2.Flags {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func (r1 *DHCID) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*DHCID)
if !ok {
return false
}
_ = r2
if r1.Digest != r2.Digest {
return false
}
return true
}
func (r1 *DLV) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*DLV)
if !ok {
return false
}
_ = r2
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func (r1 *DNAME) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*DNAME)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Target, r2.Target) {
return false
}
return true
}
func (r1 *DNSKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*DNSKEY)
if !ok {
return false
}
_ = r2
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func (r1 *DS) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*DS)
if !ok {
return false
}
_ = r2
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func (r1 *EID) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*EID)
if !ok {
return false
}
_ = r2
if r1.Endpoint != r2.Endpoint {
return false
}
return true
}
func (r1 *EUI48) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*EUI48)
if !ok {
return false
}
_ = r2
if r1.Address != r2.Address {
return false
}
return true
}
func (r1 *EUI64) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*EUI64)
if !ok {
return false
}
_ = r2
if r1.Address != r2.Address {
return false
}
return true
}
func (r1 *GID) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*GID)
if !ok {
return false
}
_ = r2
if r1.Gid != r2.Gid {
return false
}
return true
}
func (r1 *GPOS) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*GPOS)
if !ok {
return false
}
_ = r2
if r1.Longitude != r2.Longitude {
return false
}
if r1.Latitude != r2.Latitude {
return false
}
if r1.Altitude != r2.Altitude {
return false
}
return true
}
func (r1 *HINFO) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*HINFO)
if !ok {
return false
}
_ = r2
if r1.Cpu != r2.Cpu {
return false
}
if r1.Os != r2.Os {
return false
}
return true
}
func (r1 *HIP) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*HIP)
if !ok {
return false
}
_ = r2
if r1.HitLength != r2.HitLength {
return false
}
if r1.PublicKeyAlgorithm != r2.PublicKeyAlgorithm {
return false
}
if r1.PublicKeyLength != r2.PublicKeyLength {
return false
}
if r1.Hit != r2.Hit {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
if len(r1.RendezvousServers) != len(r2.RendezvousServers) {
return false
}
for i := 0; i < len(r1.RendezvousServers); i++ {
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.RendezvousServers[i], r2.RendezvousServers[i]) {
return false
}
}
return true
}
Implement SVCB (#1067) * Implement SVCB * Fix serialization and deserialization of double quotes * More effort (?) 4 months old commit * DEBUG * _ * Presentation format serialization/deserialization * _ Remove generated * Progress on presentation format parse & write * _ * Finish parsing presentation format * Regenerate * Pack unpack * Move to svcb.go Scan_rr.go and types.go should be untouched now * :bug: Thanks ghedo * Definitions * TypeHTTPSSVC * Generated and isDuplicate * Goodbye lenient functions Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN * Encode/decode * Experimental svc * Read method * Implement some of the methods, use trick... to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out Also fix two compile errors * Add SVC_LOCAL methods, reorder, remove alpn value, bugs * Errors * Alpn, make it build * Correct testsuite * Fully implement parser Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed * Simplify and document EDNS should be simplified too * Attempt to fix fuzzer And Alpn bug * A bug and change type values to match @ghedo's implementation * IP bug Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent. * Check for strictly increasing keys as required * Don't panic on invalid alpn * Redundant check, don't modify original array * Size calculation * Fix the fuzzer, match the style * 65535 is reserved too, don't delay errors * Check keyNNN, check for aliasform having values * IPvNHint is an array * Fix ipvNHint * Rename everything * Unrecognized keys according to the updated specification * Skip zero-length structs in generators. Fix CI * Doc cleanup * Off by one * Add parse tests * Check if private key doesn't collide with known key, invalid tests * Disallow IPv4 as IPv6. More tests. Related #1107 * Style fixes * More consistency, more tests * :bug: Deep copy as in the documentation a := make([]net.IP, 1) a[0] = net.ParseIP("1.1.1.1").To4() b := append(make([]net.IP, 0, 1), a...) b[0] = net.ParseIP("3.1.1.1").To4() fmt.Println(a[0][0]) * Make tests readable * Move valid parse tests to different file * :bug: One of previous commits not fully committed * Test binary single value encoding/decoding and full encode/decode * Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests * Testing improvements And don't convert to IPv4 twice * Doc update only * Document worst case allocations and ipv6 can be at most of length 39, not 40 * Redundant IP copy, consistent IPv6 behavior, fix deep copy * isDuplicate for SVCB * Optimizations * echoconfig * Svc => SVCB * Fix CI * Regenerate after REBASE (2) Rebased twice on 15th and 20th May * Rename svc, use escapeByte. * Fix parsing whitespaces between quotes, rename ECHOHOConfig * resolve Remove svcbFieldLen Use reverseInt Uppercase SVCB Rename key_value "invalid" => bad Alpn comments > 65535 check Unneeded slices * a little more read => parse IP array meaning Force pushed because forgot to change read in svcb_test.go * HTTPSSVC -> HTTPS * Use new values * mandatory code https://github.com/MikeBishop/dns-alt-svc/pull/205 * Resolve comments Rename svcb-pairs Remove SVCB_PRIVATE ranges Comment on SVCB_KEY65535 ParseError return l.token rename svcbKeyToString and svcbStringToKey privatize SVCBKeyToString, SVCBStringToKey * Refactor 1 Rename sorted, originalPairs Use append instead of copy Use svcb_RESERVED instead of 65535, with it now being private "type SVCBKey uint16" * Refactor 2 svcbKeyToString as method svcbStringToKey updated after key 0 :bug: mandatory has missing key Rename str idx < 0 * Refactor 3 Use l.token as z var key, value string Comment wrap 0: Sentences with '.' keyValue => kv * Refactor 4 * Refactor 5 len() int * Refactor 6 * Refactor 7 * Test remove parsing * Error messages * Rewrite two estimate comments * parse shouldn't modify original array :bug: * Remove two unneeded comments * Address review comments Push 2 because can't build fuzzer python Push 3 to try again * Simplify argument duplication as per tmthrgd's suggestion And add the relevant test Force push edit: Make sorting code fit into one line * Rewrite ECHConfig and address the review * Remove the optional tab * Add To4() Check * More cleanup and fix mandatory not sorting bug
2020-10-11 07:09:36 +00:00
func (r1 *HTTPS) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*HTTPS)
if !ok {
return false
}
_ = r2
if r1.Priority != r2.Priority {
return false
}
if !isDuplicateName(r1.Target, r2.Target) {
return false
}
if len(r1.Value) != len(r2.Value) {
return false
}
if !areSVCBPairArraysEqual(r1.Value, r2.Value) {
return false
}
return true
}
func (r1 *KEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*KEY)
if !ok {
return false
}
_ = r2
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func (r1 *KX) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*KX)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Exchanger, r2.Exchanger) {
return false
}
return true
}
func (r1 *L32) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*L32)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
if !r1.Locator32.Equal(r2.Locator32) {
return false
}
return true
}
func (r1 *L64) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*L64)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
if r1.Locator64 != r2.Locator64 {
return false
}
return true
}
func (r1 *LOC) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*LOC)
if !ok {
return false
}
_ = r2
if r1.Version != r2.Version {
return false
}
if r1.Size != r2.Size {
return false
}
if r1.HorizPre != r2.HorizPre {
return false
}
if r1.VertPre != r2.VertPre {
return false
}
if r1.Latitude != r2.Latitude {
return false
}
if r1.Longitude != r2.Longitude {
return false
}
if r1.Altitude != r2.Altitude {
return false
}
return true
}
func (r1 *LP) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*LP)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Fqdn, r2.Fqdn) {
return false
}
return true
}
func (r1 *MB) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MB)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mb, r2.Mb) {
return false
}
return true
}
func (r1 *MD) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MD)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Md, r2.Md) {
return false
}
return true
}
func (r1 *MF) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MF)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mf, r2.Mf) {
return false
}
return true
}
func (r1 *MG) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MG)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mg, r2.Mg) {
return false
}
return true
}
func (r1 *MINFO) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MINFO)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Rmail, r2.Rmail) {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Email, r2.Email) {
return false
}
return true
}
func (r1 *MR) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MR)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mr, r2.Mr) {
return false
}
return true
}
func (r1 *MX) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*MX)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mx, r2.Mx) {
return false
}
return true
}
func (r1 *NAPTR) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NAPTR)
if !ok {
return false
}
_ = r2
if r1.Order != r2.Order {
return false
}
if r1.Preference != r2.Preference {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Service != r2.Service {
return false
}
if r1.Regexp != r2.Regexp {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Replacement, r2.Replacement) {
return false
}
return true
}
func (r1 *NID) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NID)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
if r1.NodeID != r2.NodeID {
return false
}
return true
}
func (r1 *NIMLOC) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NIMLOC)
if !ok {
return false
}
_ = r2
if r1.Locator != r2.Locator {
return false
}
return true
}
func (r1 *NINFO) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NINFO)
if !ok {
return false
}
_ = r2
if len(r1.ZSData) != len(r2.ZSData) {
return false
}
for i := 0; i < len(r1.ZSData); i++ {
if r1.ZSData[i] != r2.ZSData[i] {
return false
}
}
return true
}
func (r1 *NS) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NS)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Ns, r2.Ns) {
return false
}
return true
}
func (r1 *NSAPPTR) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NSAPPTR)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Ptr, r2.Ptr) {
return false
}
return true
}
func (r1 *NSEC) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NSEC)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.NextDomain, r2.NextDomain) {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func (r1 *NSEC3) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NSEC3)
if !ok {
return false
}
_ = r2
if r1.Hash != r2.Hash {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Iterations != r2.Iterations {
return false
}
if r1.SaltLength != r2.SaltLength {
return false
}
if r1.Salt != r2.Salt {
return false
}
if r1.HashLength != r2.HashLength {
return false
}
if r1.NextDomain != r2.NextDomain {
return false
}
if len(r1.TypeBitMap) != len(r2.TypeBitMap) {
return false
}
for i := 0; i < len(r1.TypeBitMap); i++ {
if r1.TypeBitMap[i] != r2.TypeBitMap[i] {
return false
}
}
return true
}
func (r1 *NSEC3PARAM) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NSEC3PARAM)
if !ok {
return false
}
_ = r2
if r1.Hash != r2.Hash {
return false
}
if r1.Flags != r2.Flags {
return false
}
if r1.Iterations != r2.Iterations {
return false
}
if r1.SaltLength != r2.SaltLength {
return false
}
if r1.Salt != r2.Salt {
return false
}
return true
}
func (r1 *NULL) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*NULL)
if !ok {
return false
}
_ = r2
if r1.Data != r2.Data {
return false
}
return true
}
func (r1 *OPENPGPKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*OPENPGPKEY)
if !ok {
return false
}
_ = r2
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func (r1 *PTR) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*PTR)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Ptr, r2.Ptr) {
return false
}
return true
}
func (r1 *PX) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*PX)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Map822, r2.Map822) {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mapx400, r2.Mapx400) {
return false
}
return true
}
func (r1 *RFC3597) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*RFC3597)
if !ok {
return false
}
_ = r2
if r1.Rdata != r2.Rdata {
return false
}
return true
}
func (r1 *RKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*RKEY)
if !ok {
return false
}
_ = r2
if r1.Flags != r2.Flags {
return false
}
if r1.Protocol != r2.Protocol {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.PublicKey != r2.PublicKey {
return false
}
return true
}
func (r1 *RP) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*RP)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mbox, r2.Mbox) {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Txt, r2.Txt) {
return false
}
return true
}
func (r1 *RRSIG) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*RRSIG)
if !ok {
return false
}
_ = r2
if r1.TypeCovered != r2.TypeCovered {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Labels != r2.Labels {
return false
}
if r1.OrigTtl != r2.OrigTtl {
return false
}
if r1.Expiration != r2.Expiration {
return false
}
if r1.Inception != r2.Inception {
return false
}
if r1.KeyTag != r2.KeyTag {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.SignerName, r2.SignerName) {
return false
}
if r1.Signature != r2.Signature {
return false
}
return true
}
func (r1 *RT) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*RT)
if !ok {
return false
}
_ = r2
if r1.Preference != r2.Preference {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Host, r2.Host) {
return false
}
return true
}
func (r1 *SIG) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SIG)
if !ok {
return false
}
_ = r2
if r1.TypeCovered != r2.TypeCovered {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Labels != r2.Labels {
return false
}
if r1.OrigTtl != r2.OrigTtl {
return false
}
if r1.Expiration != r2.Expiration {
return false
}
if r1.Inception != r2.Inception {
return false
}
if r1.KeyTag != r2.KeyTag {
return false
}
if !isDuplicateName(r1.SignerName, r2.SignerName) {
return false
}
if r1.Signature != r2.Signature {
return false
}
return true
}
func (r1 *SMIMEA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SMIMEA)
if !ok {
return false
}
_ = r2
if r1.Usage != r2.Usage {
return false
}
if r1.Selector != r2.Selector {
return false
}
if r1.MatchingType != r2.MatchingType {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func (r1 *SOA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SOA)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Ns, r2.Ns) {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Mbox, r2.Mbox) {
return false
}
if r1.Serial != r2.Serial {
return false
}
if r1.Refresh != r2.Refresh {
return false
}
if r1.Retry != r2.Retry {
return false
}
if r1.Expire != r2.Expire {
return false
}
if r1.Minttl != r2.Minttl {
return false
}
return true
}
func (r1 *SPF) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SPF)
if !ok {
return false
}
_ = r2
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func (r1 *SRV) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SRV)
if !ok {
return false
}
_ = r2
if r1.Priority != r2.Priority {
return false
}
if r1.Weight != r2.Weight {
return false
}
if r1.Port != r2.Port {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Target, r2.Target) {
return false
}
return true
}
func (r1 *SSHFP) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SSHFP)
if !ok {
return false
}
_ = r2
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.Type != r2.Type {
return false
}
if r1.FingerPrint != r2.FingerPrint {
return false
}
return true
}
Implement SVCB (#1067) * Implement SVCB * Fix serialization and deserialization of double quotes * More effort (?) 4 months old commit * DEBUG * _ * Presentation format serialization/deserialization * _ Remove generated * Progress on presentation format parse & write * _ * Finish parsing presentation format * Regenerate * Pack unpack * Move to svcb.go Scan_rr.go and types.go should be untouched now * :bug: Thanks ghedo * Definitions * TypeHTTPSSVC * Generated and isDuplicate * Goodbye lenient functions Now private key=value pairs have to be defined as structs too. They are no longer automatically named as KeyNNNNN * Encode/decode * Experimental svc * Read method * Implement some of the methods, use trick... to report where the error is while reading it. This should be applied to EDNS too. Todo: Find if case can only contain e := new(SVC_ALPN) and rest moved out Also fix two compile errors * Add SVC_LOCAL methods, reorder, remove alpn value, bugs * Errors * Alpn, make it build * Correct testsuite * Fully implement parser Change from keeping a state variable to reading in one iteration until the key=value pair is fully consumed * Simplify and document EDNS should be simplified too * Attempt to fix fuzzer And Alpn bug * A bug and change type values to match @ghedo's implementation * IP bug Also there are two ip duplicating patterns, one with copy, one with append. Maybe change it to be consistent. * Check for strictly increasing keys as required * Don't panic on invalid alpn * Redundant check, don't modify original array * Size calculation * Fix the fuzzer, match the style * 65535 is reserved too, don't delay errors * Check keyNNN, check for aliasform having values * IPvNHint is an array * Fix ipvNHint * Rename everything * Unrecognized keys according to the updated specification * Skip zero-length structs in generators. Fix CI * Doc cleanup * Off by one * Add parse tests * Check if private key doesn't collide with known key, invalid tests * Disallow IPv4 as IPv6. More tests. Related #1107 * Style fixes * More consistency, more tests * :bug: Deep copy as in the documentation a := make([]net.IP, 1) a[0] = net.ParseIP("1.1.1.1").To4() b := append(make([]net.IP, 0, 1), a...) b[0] = net.ParseIP("3.1.1.1").To4() fmt.Println(a[0][0]) * Make tests readable * Move valid parse tests to different file * :bug: One of previous commits not fully committed * Test binary single value encoding/decoding and full encode/decode * Add worst-case grows to builders, :bug: Wrong visible character range, redundant tests * Testing improvements And don't convert to IPv4 twice * Doc update only * Document worst case allocations and ipv6 can be at most of length 39, not 40 * Redundant IP copy, consistent IPv6 behavior, fix deep copy * isDuplicate for SVCB * Optimizations * echoconfig * Svc => SVCB * Fix CI * Regenerate after REBASE (2) Rebased twice on 15th and 20th May * Rename svc, use escapeByte. * Fix parsing whitespaces between quotes, rename ECHOHOConfig * resolve Remove svcbFieldLen Use reverseInt Uppercase SVCB Rename key_value "invalid" => bad Alpn comments > 65535 check Unneeded slices * a little more read => parse IP array meaning Force pushed because forgot to change read in svcb_test.go * HTTPSSVC -> HTTPS * Use new values * mandatory code https://github.com/MikeBishop/dns-alt-svc/pull/205 * Resolve comments Rename svcb-pairs Remove SVCB_PRIVATE ranges Comment on SVCB_KEY65535 ParseError return l.token rename svcbKeyToString and svcbStringToKey privatize SVCBKeyToString, SVCBStringToKey * Refactor 1 Rename sorted, originalPairs Use append instead of copy Use svcb_RESERVED instead of 65535, with it now being private "type SVCBKey uint16" * Refactor 2 svcbKeyToString as method svcbStringToKey updated after key 0 :bug: mandatory has missing key Rename str idx < 0 * Refactor 3 Use l.token as z var key, value string Comment wrap 0: Sentences with '.' keyValue => kv * Refactor 4 * Refactor 5 len() int * Refactor 6 * Refactor 7 * Test remove parsing * Error messages * Rewrite two estimate comments * parse shouldn't modify original array :bug: * Remove two unneeded comments * Address review comments Push 2 because can't build fuzzer python Push 3 to try again * Simplify argument duplication as per tmthrgd's suggestion And add the relevant test Force push edit: Make sorting code fit into one line * Rewrite ECHConfig and address the review * Remove the optional tab * Add To4() Check * More cleanup and fix mandatory not sorting bug
2020-10-11 07:09:36 +00:00
func (r1 *SVCB) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*SVCB)
if !ok {
return false
}
_ = r2
if r1.Priority != r2.Priority {
return false
}
if !isDuplicateName(r1.Target, r2.Target) {
return false
}
if len(r1.Value) != len(r2.Value) {
return false
}
if !areSVCBPairArraysEqual(r1.Value, r2.Value) {
return false
}
return true
}
func (r1 *TA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TA)
if !ok {
return false
}
_ = r2
if r1.KeyTag != r2.KeyTag {
return false
}
if r1.Algorithm != r2.Algorithm {
return false
}
if r1.DigestType != r2.DigestType {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}
func (r1 *TALINK) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TALINK)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.PreviousName, r2.PreviousName) {
return false
}
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.NextName, r2.NextName) {
return false
}
return true
}
func (r1 *TKEY) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TKEY)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Algorithm, r2.Algorithm) {
return false
}
if r1.Inception != r2.Inception {
return false
}
if r1.Expiration != r2.Expiration {
return false
}
if r1.Mode != r2.Mode {
return false
}
if r1.Error != r2.Error {
return false
}
if r1.KeySize != r2.KeySize {
return false
}
if r1.Key != r2.Key {
return false
}
if r1.OtherLen != r2.OtherLen {
return false
}
if r1.OtherData != r2.OtherData {
return false
}
return true
}
func (r1 *TLSA) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TLSA)
if !ok {
return false
}
_ = r2
if r1.Usage != r2.Usage {
return false
}
if r1.Selector != r2.Selector {
return false
}
if r1.MatchingType != r2.MatchingType {
return false
}
if r1.Certificate != r2.Certificate {
return false
}
return true
}
func (r1 *TSIG) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TSIG)
if !ok {
return false
}
_ = r2
2019-02-01 16:34:24 +00:00
if !isDuplicateName(r1.Algorithm, r2.Algorithm) {
return false
}
if r1.TimeSigned != r2.TimeSigned {
return false
}
if r1.Fudge != r2.Fudge {
return false
}
if r1.MACSize != r2.MACSize {
return false
}
if r1.MAC != r2.MAC {
return false
}
if r1.OrigId != r2.OrigId {
return false
}
if r1.Error != r2.Error {
return false
}
if r1.OtherLen != r2.OtherLen {
return false
}
if r1.OtherData != r2.OtherData {
return false
}
return true
}
func (r1 *TXT) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*TXT)
if !ok {
return false
}
_ = r2
if len(r1.Txt) != len(r2.Txt) {
return false
}
for i := 0; i < len(r1.Txt); i++ {
if r1.Txt[i] != r2.Txt[i] {
return false
}
}
return true
}
func (r1 *UID) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*UID)
if !ok {
return false
}
_ = r2
if r1.Uid != r2.Uid {
return false
}
return true
}
func (r1 *UINFO) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*UINFO)
if !ok {
return false
}
_ = r2
if r1.Uinfo != r2.Uinfo {
return false
}
return true
}
func (r1 *URI) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*URI)
if !ok {
return false
}
_ = r2
if r1.Priority != r2.Priority {
return false
}
if r1.Weight != r2.Weight {
return false
}
if r1.Target != r2.Target {
return false
}
return true
}
func (r1 *X25) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*X25)
if !ok {
return false
}
_ = r2
if r1.PSDNAddress != r2.PSDNAddress {
return false
}
return true
}
func (r1 *ZONEMD) isDuplicate(_r2 RR) bool {
r2, ok := _r2.(*ZONEMD)
if !ok {
return false
}
_ = r2
if r1.Serial != r2.Serial {
return false
}
if r1.Scheme != r2.Scheme {
return false
}
if r1.Hash != r2.Hash {
return false
}
if r1.Digest != r2.Digest {
return false
}
return true
}