do I really need all those function -- no
This commit is contained in:
parent
9abebc170f
commit
d6238e8649
70
defaults.go
70
defaults.go
|
@ -123,76 +123,6 @@ func (dns *Msg) SetEdns0(udpsize uint16, do bool) *Msg {
|
|||
return dns
|
||||
}
|
||||
|
||||
// IsRcode checks if the header of the packet has rcode set.
|
||||
func (dns *Msg) IsRcode(rcode int) (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Rcode == rcode
|
||||
return
|
||||
}
|
||||
|
||||
// IsQuestion returns true if the packet is a question.
|
||||
func (dns *Msg) IsQuestion() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Response == false
|
||||
return
|
||||
}
|
||||
|
||||
// IsRcodeFormatError checks if the message has FormErr set.
|
||||
func (dns *Msg) IsRcodeFormatError() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Rcode == RcodeFormatError
|
||||
return
|
||||
}
|
||||
|
||||
// IsUpdate checks if the message is 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
|
||||
}
|
||||
|
||||
// IsNotify checks if the message is a valid notify packet.
|
||||
func (dns *Msg) IsNotify() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Opcode == OpcodeNotify
|
||||
ok = ok && dns.Question[0].Qclass == ClassINET
|
||||
ok = ok && dns.Question[0].Qtype == TypeSOA
|
||||
return
|
||||
}
|
||||
|
||||
// IsAxfr checks if the message is a valid axfr request packet.
|
||||
func (dns *Msg) IsAxfr() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Opcode == OpcodeQuery
|
||||
ok = ok && dns.Question[0].Qclass == ClassINET
|
||||
ok = ok && dns.Question[0].Qtype == TypeAXFR
|
||||
return
|
||||
}
|
||||
|
||||
// IsIXfr checks if the message is a valid ixfr request packet.
|
||||
func (dns *Msg) IsIxfr() (ok bool) {
|
||||
if len(dns.Question) == 0 {
|
||||
return false
|
||||
}
|
||||
ok = dns.MsgHdr.Opcode == OpcodeQuery
|
||||
ok = ok && dns.Question[0].Qclass == ClassINET
|
||||
ok = ok && dns.Question[0].Qtype == TypeIXFR
|
||||
return
|
||||
}
|
||||
|
||||
// IsTsig checks if the message has a TSIG record as the last record
|
||||
// in the additional section.
|
||||
func (dns *Msg) IsTsig() (ok bool) {
|
||||
|
|
Loading…
Reference in New Issue