SMall fixes
This commit is contained in:
parent
e7a8eece9b
commit
5087f5a993
20
defaults.go
20
defaults.go
|
@ -41,9 +41,16 @@ func (dns *Msg) SetRcode(request *Msg, rcode int) {
|
|||
dns.Question = make([]Question, 1)
|
||||
dns.Question[0] = request.Question[0]
|
||||
}
|
||||
// TODO isRcode for symmetry
|
||||
|
||||
// Create a FormError packet.
|
||||
func (dns *Msg) IsRcode(rcode int) (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Rcode == rcode
|
||||
return
|
||||
}
|
||||
|
||||
// Create a packet with FormError set.
|
||||
func (dns *Msg) SetRcodeFormatError(request *Msg) {
|
||||
dns.MsgHdr.Rcode = RcodeFormatError
|
||||
dns.MsgHdr.Opcode = OpcodeQuery
|
||||
|
@ -52,6 +59,15 @@ func (dns *Msg) SetRcodeFormatError(request *Msg) {
|
|||
dns.MsgHdr.Id = request.MsgHdr.Id
|
||||
}
|
||||
|
||||
// Is the message a packet with the FormErr set?
|
||||
func (dns *Msg) IsRcodeFormatError() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Rcode == RcodeFormatError
|
||||
return
|
||||
}
|
||||
|
||||
// Is the message a dynamic update packet?
|
||||
func (dns *Msg) IsUpdate() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
|
|
Loading…
Reference in New Issue