add a IsUpdate function
This commit is contained in:
parent
15518a578f
commit
9ac4df6b1d
12
defaults.go
12
defaults.go
|
@ -13,8 +13,6 @@ func (dns *Msg) SetReply(request *Msg) {
|
|||
dns.Question[0] = request.Question[0]
|
||||
}
|
||||
|
||||
// IsReply?
|
||||
|
||||
// Create a notify packet.
|
||||
func (dns *Msg) SetNotify(z string, class uint16) {
|
||||
dns.MsgHdr.Opcode = OpcodeNotify
|
||||
|
@ -24,6 +22,16 @@ func (dns *Msg) SetNotify(z string, class uint16) {
|
|||
dns.Question[0] = Question{z, TypeSOA, class}
|
||||
}
|
||||
|
||||
// Is the message a dynamic update packet?
|
||||
func (dns *Msg) IsUpdate() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Opcode == OpcodeUpdate
|
||||
ok = ok && dns.Question[0].Qtype == TypeSOA
|
||||
return
|
||||
}
|
||||
|
||||
// Is the message a valid notify packet?
|
||||
func (dns *Msg) IsNotify() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
|
|
Loading…
Reference in New Issue