nicer api
This commit is contained in:
parent
bde0b53762
commit
d728de7088
20
defaults.go
20
defaults.go
|
@ -1,7 +1,7 @@
|
||||||
package dns
|
package dns
|
||||||
|
|
||||||
// Create a notify request packet.
|
// Create a notify packet.
|
||||||
func (dns *Msg) SetNotifyRequest(z string, class uint16) {
|
func (dns *Msg) SetNotify(z string, class uint16) {
|
||||||
dns.MsgHdr.Opcode = OpcodeNotify
|
dns.MsgHdr.Opcode = OpcodeNotify
|
||||||
dns.MsgHdr.Authoritative = true
|
dns.MsgHdr.Authoritative = true
|
||||||
dns.MsgHdr.Id = Id()
|
dns.MsgHdr.Id = Id()
|
||||||
|
@ -9,16 +9,6 @@ func (dns *Msg) SetNotifyRequest(z string, class uint16) {
|
||||||
dns.Question[0] = Question{z, TypeSOA, class}
|
dns.Question[0] = Question{z, TypeSOA, class}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a notify reply packet.
|
|
||||||
func (dns *Msg) SetNotifyReply(z string, class, id uint16) {
|
|
||||||
dns.MsgHdr.Opcode = OpcodeNotify
|
|
||||||
dns.MsgHdr.Authoritative = true
|
|
||||||
dns.MsgHdr.Response = true
|
|
||||||
dns.MsgHdr.Id = id
|
|
||||||
dns.Question = make([]Question, 1)
|
|
||||||
dns.Question[0] = Question{z, TypeSOA, class}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Is a dns msg a valid notify packet?
|
// Is a dns msg a valid notify packet?
|
||||||
func (dns *Msg) IsNotify() bool {
|
func (dns *Msg) IsNotify() bool {
|
||||||
ok := dns.MsgHdr.Opcode == OpcodeNotify
|
ok := dns.MsgHdr.Opcode == OpcodeNotify
|
||||||
|
@ -30,7 +20,8 @@ func (dns *Msg) IsNotify() bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dns *Msg) SetIxfrRequest(z string, class uint16, serial uint32) {
|
// Create a dns msg suitable for requesting an ixfr.
|
||||||
|
func (dns *Msg) SetIxfr(z string, class uint16, serial uint32) {
|
||||||
dns.Question = make([]Question, 1)
|
dns.Question = make([]Question, 1)
|
||||||
dns.Ns = make([]RR, 1)
|
dns.Ns = make([]RR, 1)
|
||||||
s := new(RR_SOA)
|
s := new(RR_SOA)
|
||||||
|
@ -41,7 +32,8 @@ func (dns *Msg) SetIxfrRequest(z string, class uint16, serial uint32) {
|
||||||
dns.Ns[0] = s
|
dns.Ns[0] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dns *Msg) SetAxfrRequest(z string, class uint16) {
|
// Create a dns msg suitable for requesting an axfr.
|
||||||
|
func (dns *Msg) SetAxfr(z string, class uint16) {
|
||||||
dns.Question = make([]Question, 1)
|
dns.Question = make([]Question, 1)
|
||||||
dns.Question[0] = Question{z, TypeAXFR, class}
|
dns.Question[0] = Question{z, TypeAXFR, class}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue