Commit 74a9d28f authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

core: unblock CH class for forward as well (#1498)

Retweak this a little to make it slightly easier to *not* forget this,
but it is hardly perfect. Should probably make it an interface a plugin
can implement and then unblock if we see that interface.
parent 5a0adabc
...@@ -41,7 +41,7 @@ type Server struct { ...@@ -41,7 +41,7 @@ type Server struct {
} }
// NewServer returns a new CoreDNS server and compiles all plugins in to it. By default CH class // NewServer returns a new CoreDNS server and compiles all plugins in to it. By default CH class
// queries are blocked unless the chaos or proxy is loaded. // queries are blocked unless queries from enableChaos are loaded.
func NewServer(addr string, group []*Config) (*Server, error) { func NewServer(addr string, group []*Config) (*Server, error) {
s := &Server{ s := &Server{
...@@ -79,7 +79,8 @@ func NewServer(addr string, group []*Config) (*Server, error) { ...@@ -79,7 +79,8 @@ func NewServer(addr string, group []*Config) (*Server, error) {
s.trace = t s.trace = t
} }
} }
if stack.Name() == "chaos" || stack.Name() == "proxy" { // Unblock CH class queries when any of these plugins are loaded.
if _, ok := enableChaos[stack.Name()]; ok {
s.classChaos = true s.classChaos = true
} }
} }
...@@ -319,5 +320,13 @@ const ( ...@@ -319,5 +320,13 @@ const (
udp = 1 udp = 1
) )
// enableChaos is a map with plugin names for which we should open CH class queries as
// we block these by default.
var enableChaos = map[string]bool{
"chaos": true,
"forward": true,
"proxy": true,
}
// Quiet mode will not show any informative output on initialization. // Quiet mode will not show any informative output on initialization.
var Quiet bool var Quiet bool
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment