diff --git a/defaults.go b/defaults.go index 9fc3bc81..b5f6b61d 100644 --- a/defaults.go +++ b/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) {