mirror of
https://github.com/miekg/dns.git
synced 2025-12-16 17:21:17 +01:00
add: setUpdate to create update packets
This commit is contained in:
parent
146845ebde
commit
aaf4af6401
12
defaults.go
12
defaults.go
@ -42,7 +42,7 @@ func (dns *Msg) SetRcode(request *Msg, rcode int) {
|
|||||||
dns.Question[0] = request.Question[0]
|
dns.Question[0] = request.Question[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRocde checks if the header of the packet has rcode set.
|
// IsRcode checks if the header of the packet has rcode set.
|
||||||
func (dns *Msg) IsRcode(rcode int) (ok bool) {
|
func (dns *Msg) IsRcode(rcode int) (ok bool) {
|
||||||
if len(dns.Question) == 0 {
|
if len(dns.Question) == 0 {
|
||||||
return false
|
return false
|
||||||
@ -69,7 +69,7 @@ func (dns *Msg) IsRcodeFormatError() (ok bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is the message a dynamic update packet?
|
// IsUpdate checks if the message is a dynamic update packet?
|
||||||
func (dns *Msg) IsUpdate() (ok bool) {
|
func (dns *Msg) IsUpdate() (ok bool) {
|
||||||
if len(dns.Question) == 0 {
|
if len(dns.Question) == 0 {
|
||||||
return false
|
return false
|
||||||
@ -79,6 +79,14 @@ func (dns *Msg) IsUpdate() (ok bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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.Opcode = OpcodeUpdate
|
||||||
|
dns.Question = make([]Question, 1)
|
||||||
|
dns.Question[0] = Question{z, TypeSOA, ClassINET}
|
||||||
|
}
|
||||||
|
|
||||||
// Is the message a valid notify packet?
|
// Is the message a valid notify packet?
|
||||||
func (dns *Msg) IsNotify() (ok bool) {
|
func (dns *Msg) IsNotify() (ok bool) {
|
||||||
if len(dns.Question) == 0 {
|
if len(dns.Question) == 0 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user