From 7992bf41777c3af18cdcd32b66694b23e8a7c3c9 Mon Sep 17 00:00:00 2001 From: Alvaro Saurin Date: Thu, 19 Nov 2015 14:54:23 +0100 Subject: [PATCH] DNS upstream servers report --- nameserver/status.go | 10 ++++++---- prog/weaver/http.go | 7 +++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/nameserver/status.go b/nameserver/status.go index 6124f08d..2a280c57 100644 --- a/nameserver/status.go +++ b/nameserver/status.go @@ -1,10 +1,11 @@ package nameserver type Status struct { - Domain string - Address string - TTL uint32 - Entries []EntryStatus + Domain string + Upstream []string + Address string + TTL uint32 + Entries []EntryStatus } type EntryStatus struct { @@ -37,6 +38,7 @@ func NewStatus(ns *Nameserver, dnsServer *DNSServer) *Status { return &Status{ dnsServer.domain, + dnsServer.upstream.Servers, dnsServer.address, dnsServer.ttl, entryStatusSlice} diff --git a/prog/weaver/http.go b/prog/weaver/http.go index cb828f47..6794967e 100644 --- a/prog/weaver/http.go +++ b/prog/weaver/http.go @@ -25,6 +25,12 @@ var rootTemplate = template.New("root").Funcs(map[string]interface{}{ } return count }, + "upstreamServers": func(servers []string) string { + if len(servers) == 0 { + return "none" + } + return strings.Join(servers, ", ") + }, "printConnectionCounts": func(conns []mesh.LocalConnectionStatus) string { counts := make(map[string]int) for _, conn := range conns { @@ -108,6 +114,7 @@ var statusTemplate = defTemplate("status", `\ Service: dns Domain: {{.DNS.Domain}} + Upstream: {{upstreamServers .DNS.Upstream}} TTL: {{.DNS.TTL}} Entries: {{countDNSEntries .DNS.Entries}} {{end}}\