[plugin/cache] cache failures (#2720)
* cache failures * use ServerError
This commit is contained in:
parent
58c703f5ef
commit
be8b29cd4d
3 changed files with 46 additions and 8 deletions
|
@ -15,6 +15,8 @@ const (
|
|||
NoError Type = iota
|
||||
// NameError is a NXDOMAIN in header, SOA in auth.
|
||||
NameError
|
||||
// ServerError is a set of errors we want to cache, for now it containers SERVFAIL and NOTIMPL.
|
||||
ServerError
|
||||
// NoData indicates name found, but not the type: NOERROR in header, SOA in auth.
|
||||
NoData
|
||||
// Delegation is a msg with a pointer to another nameserver: NOERROR in header, NS in auth, optionally fluff in additional (not checked).
|
||||
|
@ -28,13 +30,14 @@ const (
|
|||
)
|
||||
|
||||
var toString = map[Type]string{
|
||||
NoError: "NOERROR",
|
||||
NameError: "NXDOMAIN",
|
||||
NoData: "NODATA",
|
||||
Delegation: "DELEGATION",
|
||||
Meta: "META",
|
||||
Update: "UPDATE",
|
||||
OtherError: "OTHERERROR",
|
||||
NoError: "NOERROR",
|
||||
NameError: "NXDOMAIN",
|
||||
ServerError: "SERVERERROR",
|
||||
NoData: "NODATA",
|
||||
Delegation: "DELEGATION",
|
||||
Meta: "META",
|
||||
Update: "UPDATE",
|
||||
OtherError: "OTHERERROR",
|
||||
}
|
||||
|
||||
func (t Type) String() string { return toString[t] }
|
||||
|
@ -106,6 +109,10 @@ func Typify(m *dns.Msg, t time.Time) (Type, *dns.OPT) {
|
|||
return NameError, opt
|
||||
}
|
||||
|
||||
if m.Rcode == dns.RcodeServerFailure || m.Rcode == dns.RcodeNotImplemented {
|
||||
return ServerError, opt
|
||||
}
|
||||
|
||||
if ns > 0 && m.Rcode == dns.RcodeSuccess {
|
||||
return Delegation, opt
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue