mirror of
https://github.com/jwhited/wgsd.git
synced 2025-10-03 03:15:33 +08:00
add cmd/coredns
This commit is contained in:
25
cmd/coredns/main.go
Normal file
25
cmd/coredns/main.go
Normal 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()
|
||||
}
|
Reference in New Issue
Block a user