diff options
author | 2016-09-17 21:24:39 +0100 | |
---|---|---|
committer | 2016-09-17 21:24:39 +0100 | |
commit | 31851c6acde5431a4acaded6aba90a2958f1cf0e (patch) | |
tree | 34babd01d1c3a69ebb107dbdf21d81cbad1c6830 /core/dnsserver/server.go | |
parent | 80b22a50713e87370c0b489feeeca481d0a159d8 (diff) | |
download | coredns-31851c6acde5431a4acaded6aba90a2958f1cf0e.tar.gz coredns-31851c6acde5431a4acaded6aba90a2958f1cf0e.tar.zst coredns-31851c6acde5431a4acaded6aba90a2958f1cf0e.zip |
coredns: default Corefile (#265)
When no Corefile is given, default to loading the whoami middleware on
the default port (2053). Also add back the -port flag that allows you
to override the default port.
Further cleanup the startup messages and use caddy's OnStartupComplete()
to blurp out which zones and ports we have. These can be suppressed
with the -quiet flag.
Normal startup:
miek.nl.:1053
miek.nl2.:1053
example.org.:1054
2016/09/17 20:41:19 [INFO] CoreDNS-001 starting
CoreDNS-001 starting
with the -quiet flag:
2016/09/17 20:41:34 [INFO] CoreDNS-001 starting
Diffstat (limited to 'core/dnsserver/server.go')
-rw-r--r-- | core/dnsserver/server.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/dnsserver/server.go b/core/dnsserver/server.go index 77a28f477..4e02f1c21 100644 --- a/core/dnsserver/server.go +++ b/core/dnsserver/server.go @@ -1,6 +1,7 @@ package dnsserver import ( + "fmt" "log" "net" "runtime" @@ -213,6 +214,18 @@ func (s *Server) ServeDNS(w dns.ResponseWriter, r *dns.Msg) { log.Printf("[INFO] \"%s %s %s\" - No such zone at %s (Remote: %s)", dns.Type(r.Question[0].Qtype), dns.Class(r.Question[0].Qclass), q, s.Addr, remoteHost) } +// OnStartupComplete lists the sites served by this server +// and any relevant information, assuming Quiet == false. +func (s *Server) OnStartupComplete() { + if Quiet { + return + } + + for zone, config := range s.zones { + fmt.Println(zone + ":" + config.Port) + } +} + // DefaultErrorFunc responds to an DNS request with an error. func DefaultErrorFunc(w dns.ResponseWriter, r *dns.Msg, rcode int) { state := request.Request{W: w, Req: r} |