"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xfr_test.go" between
dns-1.1.45.tar.gz and dns-1.1.46.tar.gz

About: GO DNS implements a DNS library in Go.

xfr_test.go  (dns-1.1.45):xfr_test.go  (dns-1.1.46)
package dns package dns
import "testing" import (
"testing"
"time"
)
var ( var (
tsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="} tsigSecret = map[string]string{"axfr.": "so6ZGir4GPAqINNh9U5c3A=="}
xfrSoa = testRR(`miek.nl. 0 IN SOA linode.atoom.net. miek.miek.nl. 2009032802 21600 7200 604800 3600`) xfrSoa = testRR(`miek.nl. 0 IN SOA linode.atoom.net. miek.miek.nl. 2009032802 21600 7200 604800 3600`)
xfrA = testRR(`x.miek.nl. 1792 IN A 10.0.0.1` ) xfrA = testRR(`x.miek.nl. 1792 IN A 10.0.0.1` )
xfrMX = testRR(`miek.nl. 1800 IN MX 1 x.miek.nl .`) xfrMX = testRR(`miek.nl. 1800 IN MX 1 x.miek.nl .`)
xfrTestData = []RR{xfrSoa, xfrA, xfrMX, xfrSoa} xfrTestData = []RR{xfrSoa, xfrA, xfrMX, xfrSoa}
) )
func InvalidXfrServer(w ResponseWriter, req *Msg) { func InvalidXfrServer(w ResponseWriter, req *Msg) {
skipping to change at line 130 skipping to change at line 133
if len(records) != len(xfrTestData) { if len(records) != len(xfrTestData) {
t.Fatalf("bad axfr: expected %v, got %v", records, xfrTestData) t.Fatalf("bad axfr: expected %v, got %v", records, xfrTestData)
} }
for i, rr := range records { for i, rr := range records {
if !IsDuplicate(rr, xfrTestData[i]) { if !IsDuplicate(rr, xfrTestData[i]) {
t.Fatalf("bad axfr: expected %v, got %v", records, xfrTes tData) t.Fatalf("bad axfr: expected %v, got %v", records, xfrTes tData)
} }
} }
} }
func axfrTestingSuiteWithCustomTsig(t *testing.T, addrstr string, provider TsigP
rovider) {
tr := new(Transfer)
m := new(Msg)
var err error
tr.Conn, err = Dial("tcp", addrstr)
if err != nil {
t.Fatal("failed to dial", err)
}
tr.TsigProvider = provider
m.SetAxfr("miek.nl.")
m.SetTsig("axfr.", HmacSHA256, 300, time.Now().Unix())
c, err := tr.In(m, addrstr)
if err != nil {
t.Fatal("failed to zone transfer in", err)
}
var records []RR
for msg := range c {
if msg.Error != nil {
t.Fatal(msg.Error)
}
records = append(records, msg.RR...)
}
if len(records) != len(xfrTestData) {
t.Fatalf("bad axfr: expected %v, got %v", records, xfrTestData)
}
for i, rr := range records {
if !IsDuplicate(rr, xfrTestData[i]) {
t.Errorf("bad axfr: expected %v, got %v", records, xfrTes
tData)
}
}
}
func TestCustomTsigProvider(t *testing.T) {
HandleFunc("miek.nl.", SingleEnvelopeXfrServer)
defer HandleRemove("miek.nl.")
s, addrstr, _, err := RunLocalTCPServer(":0", func(srv *Server) {
srv.TsigProvider = tsigSecretProvider(tsigSecret)
})
if err != nil {
t.Fatalf("unable to run test server: %s", err)
}
defer s.Shutdown()
axfrTestingSuiteWithCustomTsig(t, addrstr, tsigSecretProvider(tsigSecret)
)
}
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)