|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
package ncdomain_test
|
|
|
|
|
|
|
|
|
|
import "github.com/hlandau/ncdns/convert"
|
|
|
|
|
import "github.com/hlandau/ncdns/ncdomain"
|
|
|
|
|
import "github.com/miekg/dns"
|
|
|
|
|
import "testing"
|
|
|
|
|
import "net"
|
|
|
|
@ -8,48 +8,48 @@ import "fmt"
|
|
|
|
|
|
|
|
|
|
type item struct {
|
|
|
|
|
jsonValue string
|
|
|
|
|
value *convert.Value
|
|
|
|
|
value *ncdomain.Value
|
|
|
|
|
expectedError error
|
|
|
|
|
merges map[string]string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var suite = []item{
|
|
|
|
|
item{`{}`, &convert.Value{}, nil, nil},
|
|
|
|
|
item{`{"ip":"1.2.3.4"}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4"]}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4","200.200.200.200"]}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4"), net.ParseIP("200.200.200.200")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":"dead:b33f::deca:fbad"}`, &convert.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":["dead:b33f::deca:fbad"]}`, &convert.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":["dead:b33f::deca:fbad","1234:abcd:5678:bcde:9876:fedc:5432:ba98"]}`, &convert.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad"), net.ParseIP("1234:abcd:5678:bcde:9876:fedc:5432:ba98")}}, nil, nil},
|
|
|
|
|
item{`{"ns":"alpha.beta.gamma.delta"}`, &convert.Value{NS: []string{"alpha.beta.gamma.delta"}}, nil, nil},
|
|
|
|
|
item{`{"ns":["alpha.beta.gamma.delta"]}`, &convert.Value{NS: []string{"alpha.beta.gamma.delta"}}, nil, nil},
|
|
|
|
|
item{`{"ns":["alpha.beta.gamma.delta","delta.gamma.beta.alpha"]}`, &convert.Value{NS: []string{"alpha.beta.gamma.delta", "delta.gamma.beta.alpha"}}, nil, nil},
|
|
|
|
|
item{`{"mx":[[10,"alpha.beta.gamma.delta"]]}`, &convert.Value{MX: []dns.MX{dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 10, Mx: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"mx":[[10,"alpha.beta.gamma.delta"],[20,"epsilon.example"]]}`, &convert.Value{MX: []dns.MX{dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 10, Mx: "alpha.beta.gamma.delta"}, dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 20, Mx: "epsilon.example"}}}, nil, nil},
|
|
|
|
|
item{`{"alias":"alpha.beta.gamma.delta"}`, &convert.Value{Alias: "alpha.beta.gamma.delta"}, nil, nil},
|
|
|
|
|
item{`{"translate":"alpha.beta.gamma.delta"}`, &convert.Value{Translate: "alpha.beta.gamma.delta"}, nil, nil},
|
|
|
|
|
item{`{"txt":"text record"}`, &convert.Value{TXT: [][]string{[]string{"text record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":"[text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record]"}`, &convert.Value{TXT: [][]string{[]string{"[text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record]", "[text ... record]"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":["text record"]}`, &convert.Value{TXT: [][]string{[]string{"text record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":["text record","text record 2"]}`, &convert.Value{TXT: [][]string{[]string{"text record"}, []string{"text record 2"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":[["text", "record"]]}`, &convert.Value{TXT: [][]string{[]string{"text", "record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":[["text", "record"],["text", "record", "2"]]}`, &convert.Value{TXT: [][]string{[]string{"text", "record"}, []string{"text", "record", "2"}}}, nil, nil},
|
|
|
|
|
item{`{"service":[ ["http","tcp",1,2,80,"alpha.beta.gamma.delta"] ]}`, &convert.Value{Service: []dns.SRV{dns.SRV{Hdr: dns.RR_Header{Name: "_http._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 80, Target: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"service":[ ["http","tcp",1,2,80,"alpha.beta.gamma.delta"], ["https","tcp",1,2,443,"alpha.beta.gamma.delta"] ]}`, &convert.Value{Service: []dns.SRV{dns.SRV{Hdr: dns.RR_Header{Name: "_http._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 80, Target: "alpha.beta.gamma.delta"}, dns.SRV{Hdr: dns.RR_Header{Name: "_https._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 443, Target: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": { } }}`, &convert.Value{}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": { "ip": "1.2.3.4" } }}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "www": { "ip": "1.2.3.4" } }}`, &convert.Value{Map: map[string]*convert.Value{"www": &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": "1.2.3.4" }}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "www": "1.2.3.4" }}`, &convert.Value{Map: map[string]*convert.Value{"www": &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}}}, nil, nil},
|
|
|
|
|
item{`{"ds":[[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]]}`, &convert.Value{DS: []dns.DS{dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, nil},
|
|
|
|
|
item{`{"ds":[[54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="],[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]]}`, &convert.Value{DS: []dns.DS{dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 54321, Algorithm: 8, DigestType: 1, Digest: "e6c1716cfb6bdc84e84ce1ab5510dac69173b5b2"}, dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, nil},
|
|
|
|
|
item{`{"email":"hostmaster@example.com"}`, &convert.Value{Hostmaster: "hostmaster@example.com"}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"import":"d/example"}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"import":"d/example"}`, &convert.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip":["2.3.4.5"],"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ns":["alpha.beta"],"import":"d/example"}`, &convert.Value{NS: []string{"alpha.beta"}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ns":["gamma.delta"],"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ds":[[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]],"import":"d/example"}`, &convert.Value{DS: []dns.DS{dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, map[string]string{"d/example": `{"ds":[ [54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="] ]}`}},
|
|
|
|
|
item{`{"import":"d/example"}`, &convert.Value{DS: []dns.DS{dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 54321, Algorithm: 8, DigestType: 1, Digest: "e6c1716cfb6bdc84e84ce1ab5510dac69173b5b2"}}}, nil, map[string]string{"d/example": `{"ds":[ [54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="] ]}`}},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"delegate":"d/example"}`, &convert.Value{IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{}`, &ncdomain.Value{}, nil, nil},
|
|
|
|
|
item{`{"ip":"1.2.3.4"}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4"]}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4","200.200.200.200"]}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4"), net.ParseIP("200.200.200.200")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":"dead:b33f::deca:fbad"}`, &ncdomain.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":["dead:b33f::deca:fbad"]}`, &ncdomain.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad")}}, nil, nil},
|
|
|
|
|
item{`{"ip6":["dead:b33f::deca:fbad","1234:abcd:5678:bcde:9876:fedc:5432:ba98"]}`, &ncdomain.Value{IP6: []net.IP{net.ParseIP("dead:b33f::deca:fbad"), net.ParseIP("1234:abcd:5678:bcde:9876:fedc:5432:ba98")}}, nil, nil},
|
|
|
|
|
item{`{"ns":"alpha.beta.gamma.delta"}`, &ncdomain.Value{NS: []string{"alpha.beta.gamma.delta"}}, nil, nil},
|
|
|
|
|
item{`{"ns":["alpha.beta.gamma.delta"]}`, &ncdomain.Value{NS: []string{"alpha.beta.gamma.delta"}}, nil, nil},
|
|
|
|
|
item{`{"ns":["alpha.beta.gamma.delta","delta.gamma.beta.alpha"]}`, &ncdomain.Value{NS: []string{"alpha.beta.gamma.delta", "delta.gamma.beta.alpha"}}, nil, nil},
|
|
|
|
|
item{`{"mx":[[10,"alpha.beta.gamma.delta"]]}`, &ncdomain.Value{MX: []*dns.MX{&dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 10, Mx: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"mx":[[10,"alpha.beta.gamma.delta"],[20,"epsilon.example"]]}`, &ncdomain.Value{MX: []*dns.MX{&dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 10, Mx: "alpha.beta.gamma.delta"}, &dns.MX{Hdr: dns.RR_Header{Rrtype: dns.TypeMX, Class: dns.ClassINET, Ttl: 600}, Preference: 20, Mx: "epsilon.example"}}}, nil, nil},
|
|
|
|
|
item{`{"alias":"alpha.beta.gamma.delta"}`, &ncdomain.Value{Alias: "alpha.beta.gamma.delta"}, nil, nil},
|
|
|
|
|
item{`{"translate":"alpha.beta.gamma.delta"}`, &ncdomain.Value{Translate: "alpha.beta.gamma.delta"}, nil, nil},
|
|
|
|
|
item{`{"txt":"text record"}`, &ncdomain.Value{TXT: [][]string{[]string{"text record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":"[text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record]"}`, &ncdomain.Value{TXT: [][]string{[]string{"[text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record][text ... record]", "[text ... record]"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":["text record"]}`, &ncdomain.Value{TXT: [][]string{[]string{"text record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":["text record","text record 2"]}`, &ncdomain.Value{TXT: [][]string{[]string{"text record"}, []string{"text record 2"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":[["text", "record"]]}`, &ncdomain.Value{TXT: [][]string{[]string{"text", "record"}}}, nil, nil},
|
|
|
|
|
item{`{"txt":[["text", "record"],["text", "record", "2"]]}`, &ncdomain.Value{TXT: [][]string{[]string{"text", "record"}, []string{"text", "record", "2"}}}, nil, nil},
|
|
|
|
|
item{`{"service":[ ["http","tcp",1,2,80,"alpha.beta.gamma.delta"] ]}`, &ncdomain.Value{Service: []*dns.SRV{&dns.SRV{Hdr: dns.RR_Header{Name: "_http._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 80, Target: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"service":[ ["http","tcp",1,2,80,"alpha.beta.gamma.delta"], ["https","tcp",1,2,443,"alpha.beta.gamma.delta"] ]}`, &ncdomain.Value{Service: []*dns.SRV{&dns.SRV{Hdr: dns.RR_Header{Name: "_http._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 80, Target: "alpha.beta.gamma.delta"}, &dns.SRV{Hdr: dns.RR_Header{Name: "_https._tcp", Ttl: 600, Rrtype: dns.TypeSRV, Class: dns.ClassINET}, Priority: 1, Weight: 2, Port: 443, Target: "alpha.beta.gamma.delta"}}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": { } }}`, &ncdomain.Value{}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": { "ip": "1.2.3.4" } }}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "www": { "ip": "1.2.3.4" } }}`, &ncdomain.Value{Map: map[string]*ncdomain.Value{"www": &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "": "1.2.3.4" }}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}, nil, nil},
|
|
|
|
|
item{`{"map":{ "www": "1.2.3.4" }}`, &ncdomain.Value{Map: map[string]*ncdomain.Value{"www": &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}}}}, nil, nil},
|
|
|
|
|
item{`{"ds":[[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]]}`, &ncdomain.Value{DS: []*dns.DS{&dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, nil},
|
|
|
|
|
item{`{"ds":[[54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="],[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]]}`, &ncdomain.Value{DS: []*dns.DS{&dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 54321, Algorithm: 8, DigestType: 1, Digest: "e6c1716cfb6bdc84e84ce1ab5510dac69173b5b2"}, &dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, nil},
|
|
|
|
|
item{`{"email":"hostmaster@example.com"}`, &ncdomain.Value{Hostmaster: "hostmaster@example.com"}, nil, nil},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"import":"d/example"}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"import":"d/example"}`, &ncdomain.Value{IP: []net.IP{net.ParseIP("1.2.3.4")}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip":["2.3.4.5"],"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ns":["alpha.beta"],"import":"d/example"}`, &ncdomain.Value{NS: []string{"alpha.beta"}, IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ns":["gamma.delta"],"ip6":["::beef"]}`}},
|
|
|
|
|
item{`{"ds":[[12345,8,2,"4tPJFvbe6scylOgmj7WIUESoM/xUWViPSpGEz8QaV2Y="]],"import":"d/example"}`, &ncdomain.Value{DS: []*dns.DS{&dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 12345, Algorithm: 8, DigestType: 2, Digest: "e2d3c916f6deeac73294e8268fb5885044a833fc5459588f4a9184cfc41a5766"}}}, nil, map[string]string{"d/example": `{"ds":[ [54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="] ]}`}},
|
|
|
|
|
item{`{"import":"d/example"}`, &ncdomain.Value{DS: []*dns.DS{&dns.DS{Hdr: dns.RR_Header{Rrtype: dns.TypeDS, Class: dns.ClassINET, Ttl: 600}, KeyTag: 54321, Algorithm: 8, DigestType: 1, Digest: "e6c1716cfb6bdc84e84ce1ab5510dac69173b5b2"}}}, nil, map[string]string{"d/example": `{"ds":[ [54321,8,1,"5sFxbPtr3IToTOGrVRDaxpFztbI="] ]}`}},
|
|
|
|
|
item{`{"ip":["1.2.3.4"],"delegate":"d/example"}`, &ncdomain.Value{IP6: []net.IP{net.ParseIP("::beef")}}, nil, map[string]string{"d/example": `{"ip6":["::beef"]}`}},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestConversion(t *testing.T) {
|
|
|
|
@ -65,7 +65,7 @@ func TestConversion(t *testing.T) {
|
|
|
|
|
return "", fmt.Errorf("not found")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
v, err := convert.ParseValue(item.jsonValue, resolve)
|
|
|
|
|
v, err := ncdomain.ParseValue(item.jsonValue, resolve)
|
|
|
|
|
if err != item.expectedError {
|
|
|
|
|
t.Errorf("Item %d did not match expected error: got %+v but expected %+v", i, err, item.expectedError)
|
|
|
|
|
}
|
|
|
|
@ -77,7 +77,7 @@ func TestConversion(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
// utility functions for testing equality
|
|
|
|
|
|
|
|
|
|
func equals(v1 *convert.Value, v2 *convert.Value) bool {
|
|
|
|
|
func equals(v1 *ncdomain.Value, v2 *ncdomain.Value) bool {
|
|
|
|
|
return (v1 != nil) == (v2 != nil) &&
|
|
|
|
|
eqIPArray(v1.IP, v2.IP) &&
|
|
|
|
|
eqIPArray(v1.IP6, v2.IP6) &&
|
|
|
|
@ -113,7 +113,7 @@ func eqStringArray(a []string, b []string) bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func eqDSArray(a []dns.DS, b []dns.DS) bool {
|
|
|
|
|
func eqDSArray(a []*dns.DS, b []*dns.DS) bool {
|
|
|
|
|
if len(a) != len(b) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
@ -125,7 +125,7 @@ func eqDSArray(a []dns.DS, b []dns.DS) bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func eqDS(a dns.DS, b dns.DS) bool {
|
|
|
|
|
func eqDS(a *dns.DS, b *dns.DS) bool {
|
|
|
|
|
return a.KeyTag == b.KeyTag && a.Algorithm == b.Algorithm &&
|
|
|
|
|
a.DigestType == b.DigestType && a.Digest == b.Digest && eqHdr(a.Hdr, b.Hdr)
|
|
|
|
|
}
|
|
|
|
@ -146,7 +146,7 @@ func eqStringArrayArray(a [][]string, b [][]string) bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func eqServiceArray(a []dns.SRV, b []dns.SRV) bool {
|
|
|
|
|
func eqServiceArray(a []*dns.SRV, b []*dns.SRV) bool {
|
|
|
|
|
if len(a) != len(b) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
@ -158,12 +158,12 @@ func eqServiceArray(a []dns.SRV, b []dns.SRV) bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func eqService(a dns.SRV, b dns.SRV) bool {
|
|
|
|
|
func eqService(a *dns.SRV, b *dns.SRV) bool {
|
|
|
|
|
return a.Priority == b.Priority && a.Weight == b.Weight &&
|
|
|
|
|
a.Port == b.Port && a.Target == b.Target && eqHdr(a.Hdr, b.Hdr)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func eqValueMap(a *convert.Value, b *convert.Value) bool {
|
|
|
|
|
func eqValueMap(a *ncdomain.Value, b *ncdomain.Value) bool {
|
|
|
|
|
if len(a.Map) != len(b.Map) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|