mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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.
This commit is contained in:
@@ -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) {
|
|||||||
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 (
|
|||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user