mirror of
https://github.com/coredns/coredns.git
synced 2026-10-08 19:45:21 -04:00
plugin: use Zones.Contains when any match suffices (#8505)
This commit is contained in:
4
plugin/cache/cache.go
vendored
4
plugin/cache/cache.go
vendored
@@ -468,7 +468,7 @@ func (w *ResponseWriter) set(m *dns.Msg, key uint64, mt response.Type, duration
|
||||
// and key is valid
|
||||
switch mt {
|
||||
case response.NoError, response.Delegation:
|
||||
if plugin.Zones(w.pexcept).Matches(m.Question[0].Name) != "" {
|
||||
if plugin.Zones(w.pexcept).Contains(m.Question[0].Name) {
|
||||
// zone is in exception list, do not cache
|
||||
return
|
||||
}
|
||||
@@ -493,7 +493,7 @@ func (w *ResponseWriter) set(m *dns.Msg, key uint64, mt response.Type, duration
|
||||
}
|
||||
|
||||
case response.NameError, response.NoData, response.ServerError:
|
||||
if plugin.Zones(w.nexcept).Matches(m.Question[0].Name) != "" {
|
||||
if plugin.Zones(w.nexcept).Contains(m.Question[0].Name) {
|
||||
// zone is in exception list, do not cache
|
||||
return
|
||||
}
|
||||
|
||||
3
plugin/cache/handler.go
vendored
3
plugin/cache/handler.go
vendored
@@ -21,8 +21,7 @@ func (c *Cache) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
|
||||
cd := r.CheckingDisabled
|
||||
ad := r.AuthenticatedData
|
||||
|
||||
zone := plugin.Zones(c.Zones).Matches(state.Name())
|
||||
if zone == "" {
|
||||
if !plugin.Zones(c.Zones).Contains(state.Name()) {
|
||||
return plugin.NextOrFailure(c.Name(), c.Next, ctx, w, rc)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user