From 50f6402774bbff5b60a882bf34a481ee1a49543e Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Tue, 17 Mar 2015 14:28:26 +0000 Subject: [PATCH] Include DNS version and domain in status --- nameserver/http.go | 5 +++-- weavedns/main.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nameserver/http.go b/nameserver/http.go index 83fbbf0e..5e3e7181 100644 --- a/nameserver/http.go +++ b/nameserver/http.go @@ -17,12 +17,13 @@ func httpErrorAndLog(level *log.Logger, w http.ResponseWriter, msg string, level.Printf("[http] "+logmsg, logargs...) } -func ListenHttp(domain string, db Zone, port int) { +func ListenHttp(version string, domain string, db Zone, port int) { router := mux.NewRouter() router.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - io.WriteString(w, "ok") + io.WriteString(w, fmt.Sprintln("weave DNS", version)) + io.WriteString(w, fmt.Sprintln("Serving domain", domain)) }) router.Methods("PUT").Path("/name/{identifier:.+}/{ip:.+}").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/weavedns/main.go b/weavedns/main.go index 46560467..9e1fd2fb 100644 --- a/weavedns/main.go +++ b/weavedns/main.go @@ -83,7 +83,7 @@ func main() { Debug.Printf("DNS fallback at %s:%s", fallbackHost, fallbackPort) } - go weavedns.ListenHttp(localDomain, zone, httpPort) + go weavedns.ListenHttp(version, localDomain, zone, httpPort) srv, err := weavedns.NewDNSServer(srvConfig, zone, iface) if err != nil { Error.Fatal("Failed to initialize the WeaveDNS server", err)