mirror of
https://github.com/miekg/dns.git
synced 2025-12-15 16:51:48 +01:00
Shorter function for SetUpdate and doc
This commit is contained in:
parent
5a7fb7a15f
commit
0351073d8e
@ -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.
|
||||
|
||||
46
dns_test.go
46
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()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user