diff --git a/defaults.go b/defaults.go index 84b12f87..605901b8 100644 --- a/defaults.go +++ b/defaults.go @@ -54,10 +54,7 @@ func (dns *Msg) SetRcodeFormatError(request *Msg) { // SetUpdate makes the message a dynamic update packet. It // sets the ZONE section to: z, TypeSOA, classINET. func (dns *Msg) SetUpdate(z string) { - dns.MsgHdr.Id = Id() - dns.MsgHdr.Opcode = OpcodeUpdate - dns.Question = make([]Question, 1) - dns.Question[0] = Question{z, TypeSOA, ClassINET} + return NewUpdate(z, ClassINET) } // SetIxfr creates dns msg suitable for requesting an ixfr. diff --git a/dns_test.go b/dns_test.go index 3bcc6f70..9eb44143 100644 --- a/dns_test.go +++ b/dns_test.go @@ -78,49 +78,3 @@ func TestEDNS_RR(t *testing.T) { edns.Option[0].Data = "lalalala" //t..Logf("%v\n", edns) } - -/* -func TestTsig(t *testing.T) { - tsig := new(Tsig) - tsig.Name = "axfr." - tsig.Algorithm = HmacMD5 - tsig.Fudge = 300 - tsig.TimeSigned = uint64(time.Seconds()) - tsig.Secret = "so6ZGir4GPAqINNh9U5c3A==" - - // Perform a TSIG from miek.nl - m := new(Msg) - m.Question = make([]Question, 1) - m.Question[0] = Question{"miek.nl.", TypeAXFR, ClassINET} - m.Id = Id() - - res := new(Resolver) - res.FromFile("/etc/resolv.conf") - res.Servers = []string{"85.223.71.124"} - res.Tcp = true - - c := make(chan Xfr) - go res.XfrTsig(m, tsig, c) - for x := range c { - if x.Err != nil { - t.Logf("Failed Xfr from miek.nl %v\n", x.Err) - t.Fail() - } - } - - tsig.Secret = "ZGZqc2tmZAo=" - // Do it again, must fail - c = make(chan Xfr) // Reopen the channel - go res.XfrTsig(m, tsig, c) - ok := false - for x := range c { - if x.Err != nil { - ok = true - } - } - if ok == true { - t.Logf("AXFR with wrong secret should fail") - t.Fail() - } -} -*/