middleware/cache: don't cache expired RRSIGs (#641)

Check message for expired sig and don't cache those.

Aside: This hack of caching entire messages is probably something we
should stop doing at some point in the future and do this on a per RRset
basis.

Fixes #367 #635
This commit is contained in:
Miek Gieben
2017-04-29 15:06:42 +01:00
committed by Yong Tang
parent 1f63e639e4
commit 7d39c2ba51
7 changed files with 172 additions and 62 deletions

View File

@@ -1,10 +1,6 @@
package response
import (
"fmt"
"github.com/miekg/dns"
)
import "fmt"
// Class holds sets of Types
type Class int
@@ -50,14 +46,8 @@ func ClassFromString(s string) (Class, error) {
return All, fmt.Errorf("invalid Class: %s", s)
}
// Classify classifies a dns message: it returns its Class.
func Classify(m *dns.Msg) (Class, *dns.OPT) {
t, o := Typify(m)
return classify(t), o
}
// Does need to be exported?
func classify(t Type) Class {
// Classify classifies the Type t, it returns its Class.
func Classify(t Type) Class {
switch t {
case NoError, Delegation:
return Success