test multiple messages
This commit is contained in:
parent
1f03789dcb
commit
d814a20623
|
@ -76,7 +76,6 @@ func TestClientTsigAXFR(t *testing.T) {
|
||||||
secrets := make(map[string]string)
|
secrets := make(map[string]string)
|
||||||
secrets["axfr."] = "so6ZGir4GPAqINNh9U5c3A=="
|
secrets["axfr."] = "so6ZGir4GPAqINNh9U5c3A=="
|
||||||
|
|
||||||
println(m.String())
|
|
||||||
c := NewClient()
|
c := NewClient()
|
||||||
c.Net = "tcp"
|
c.Net = "tcp"
|
||||||
c.TsigSecret = secrets
|
c.TsigSecret = secrets
|
||||||
|
@ -87,9 +86,28 @@ func TestClientTsigAXFR(t *testing.T) {
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
ex := <-c.ReplyChan
|
ex := <-c.ReplyChan
|
||||||
println(ex.Reply.String())
|
t.Log(ex.Reply.String())
|
||||||
println(ex.Error.String())
|
if ex.Error == ErrXfrLast {
|
||||||
if ex.Error != nil {
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestClientAXFRMultipleMessages(t *testing.T) {
|
||||||
|
m := new(Msg)
|
||||||
|
m.SetAxfr("dnsex.nl.")
|
||||||
|
|
||||||
|
c := NewClient()
|
||||||
|
c.Net = "tcp"
|
||||||
|
|
||||||
|
if err := c.XfrReceive(m, "85.223.71.124:53"); err != nil {
|
||||||
|
t.Log("Failed to setup axfr" + err.String())
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
for {
|
||||||
|
ex := <-c.ReplyChan
|
||||||
|
t.Log(ex.Reply.String())
|
||||||
|
if ex.Error == ErrXfrLast {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
xfr.go
6
xfr.go
|
@ -41,7 +41,10 @@ func (w *reply) axfrReceive() {
|
||||||
w.Client().ReplyChan <- &Exchange{w.req, in, err}
|
w.Client().ReplyChan <- &Exchange{w.req, in, err}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
/* id check */
|
if w.req.Id != in.Id {
|
||||||
|
w.Client().ReplyChan <- &Exchange{w.req, in, ErrId}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if first {
|
if first {
|
||||||
if !checkXfrSOA(in, true) {
|
if !checkXfrSOA(in, true) {
|
||||||
|
@ -74,7 +77,6 @@ func (w *reply) ixfrReceive() {
|
||||||
w.Client().ReplyChan <- &Exchange{w.req, in, err}
|
w.Client().ReplyChan <- &Exchange{w.req, in, err}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if w.req.Id != in.Id {
|
if w.req.Id != in.Id {
|
||||||
w.Client().ReplyChan <- &Exchange{w.req, in, ErrId}
|
w.Client().ReplyChan <- &Exchange{w.req, in, ErrId}
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue