add cmd/coredns

This commit is contained in:
Jordan Whited
2020-05-26 12:14:32 -07:00
parent f4092834a6
commit 4f2477b43c
3 changed files with 90 additions and 2 deletions

25
cmd/coredns/main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
_ "github.com/coredns/coredns/core/plugin"
_ "github.com/jwhited/wgsd"
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/coremain"
)
func init() {
// plugin ordering matters, insert wgsd with other "authoritative" plugins.
for i, name := range dnsserver.Directives {
if name == "file" {
dnsserver.Directives = append(dnsserver.Directives[:i],
append([]string{"wgsd"}, dnsserver.Directives[i:]...)...)
return
}
}
panic("file plugin not found in dnsserver.Directives")
}
func main() {
coremain.Run()
}