Some documentation fixes and origid is not needed in tsig
This commit is contained in:
parent
0ff492af57
commit
983d979698
|
@ -82,15 +82,14 @@ func (dns *Msg) SetAxfr(z string) {
|
|||
|
||||
// SetTsig appends a TSIG RR to the message.
|
||||
// This is only a skeleton Tsig RR that is added as the last RR in the
|
||||
// additional section. The Tsig is calculated when the message is being
|
||||
// send.
|
||||
func (dns *Msg) SetTsig(z, algo string, fudge, origid uint16, timesigned int64) {
|
||||
// additional section. The Tsig is calculated when the message is being send.
|
||||
func (dns *Msg) SetTsig(z, algo string, fudge, timesigned int64) {
|
||||
t := new(RR_TSIG)
|
||||
t.Hdr = RR_Header{z, TypeTSIG, ClassANY, 0, 0}
|
||||
t.Algorithm = algo
|
||||
t.Fudge = 300
|
||||
t.TimeSigned = uint64(timesigned)
|
||||
t.OrigId = origid
|
||||
t.OrigId = dns.MsgHdr.Id
|
||||
dns.Extra = append(dns.Extra, t)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ func main() {
|
|||
a := strings.SplitN(*tsig, ":", 2)
|
||||
name, secret := a[0], a[1]
|
||||
client.TsigSecret = map[string]string{name: secret}
|
||||
m.SetTsig(name, dns.HmacMD5, 300, m.MsgHdr.Id, time.Now().Unix())
|
||||
m.SetTsig(name, dns.HmacMD5, 300, time.Now().Unix())
|
||||
}
|
||||
|
||||
if t, e := client.XfrReceive(m, *nameserver); e == nil {
|
||||
|
|
5
tsig.go
5
tsig.go
|
@ -24,7 +24,8 @@
|
|||
// m := new(dns.Msg)
|
||||
// m.SetAxfr("miek.nl.")
|
||||
// m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix())
|
||||
// err := c.XfrReceive(m, "85.223.71.124:53")
|
||||
// t, err := c.XfrReceive(m, "85.223.71.124:53")
|
||||
// for r := range t { /* ... */ }
|
||||
//
|
||||
// You can now read the records from the AXFR as they come in. Each envelope is checked with TSIG.
|
||||
// If something is not correct an error is returned.
|
||||
|
@ -39,7 +40,7 @@
|
|||
// if r.IsTsig() {
|
||||
// if w.TsigStatus() == nil {
|
||||
// // *Msg r has an TSIG record and it was validated
|
||||
// m.SetTsig("axfr.", dns.HmacMD5, 300, r.MsgHdr.Id, time.Now().Unix())
|
||||
// m.SetTsig("axfr.", dns.HmacMD5, 300, time.Now().Unix())
|
||||
// } else {
|
||||
// // *Msg r has an TSIG records and it was not valided
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue