diff --git a/mesh/status.go b/mesh/status.go index 0dce08bb..559dae66 100644 --- a/mesh/status.go +++ b/mesh/status.go @@ -2,6 +2,7 @@ package mesh import ( "fmt" + "net" ) type Status struct { @@ -19,6 +20,7 @@ type Status struct { Connections []LocalConnectionStatus Targets []string OverlayDiagnostics interface{} + TrustedSubnets []string } type PeerStatus struct { @@ -69,7 +71,8 @@ func NewStatus(router *Router) *Status { NewBroadcastRouteStatusSlice(router.Routes), NewLocalConnectionStatusSlice(router.ConnectionMaker), NewTargetSlice(router.ConnectionMaker), - router.Overlay.Diagnostics()} + router.Overlay.Diagnostics(), + NewTrustedSubnetsSlice(router.TrustedSubnets)} } func NewPeerStatusSlice(peers *Peers) []PeerStatus { @@ -147,6 +150,13 @@ func NewLocalConnectionStatusSlice(cm *ConnectionMaker) []LocalConnectionStatus } lc, _ := conn.(*LocalConnection) info := fmt.Sprintf("%-6v %v", lc.OverlayConn.DisplayName(), conn.Remote()) + if lc.Router.UsingPassword() { + if lc.Untrusted() { + info = fmt.Sprintf("%-11v %v", "encrypted", info) + } else { + info = fmt.Sprintf("%-11v %v", "unencrypted", info) + } + } slice = append(slice, LocalConnectionStatus{conn.RemoteTCPAddr(), conn.Outbound(), state, info}) } for address, target := range cm.targets { @@ -191,3 +201,11 @@ func NewTargetSlice(cm *ConnectionMaker) []string { } return <-resultChan } + +func NewTrustedSubnetsSlice(trustedSubnets []*net.IPNet) []string { + trustedSubnetStrs := []string{} + for _, trustedSubnet := range trustedSubnets { + trustedSubnetStrs = append(trustedSubnetStrs, trustedSubnet.String()) + } + return trustedSubnetStrs +} diff --git a/prog/weaver/http.go b/prog/weaver/http.go index 1dc84925..2fed6787 100644 --- a/prog/weaver/http.go +++ b/prog/weaver/http.go @@ -27,11 +27,11 @@ var rootTemplate = template.New("root").Funcs(map[string]interface{}{ } return count }, - "upstreamServers": func(servers []string) string { - if len(servers) == 0 { + "printList": func(list []string) string { + if len(list) == 0 { return "none" } - return strings.Join(servers, ", ") + return strings.Join(list, ", ") }, "printIPAMRanges": func(router weave.NetworkRouterStatus, status ipam.Status) string { var buffer bytes.Buffer @@ -153,6 +153,7 @@ var statusTemplate = defTemplate("status", `\ Targets: {{len .Router.Targets}} Connections: {{len .Router.Connections}}{{with printConnectionCounts .Router.Connections}} ({{.}}){{end}} Peers: {{len .Router.Peers}}{{with printPeerConnectionCounts .Router.Peers}} (with {{.}} connections){{end}} +TrustedSubnets: {{printList .Router.TrustedSubnets}} {{if .IPAM}}\ Service: ipam @@ -176,7 +177,7 @@ var statusTemplate = defTemplate("status", `\ Service: dns Domain: {{.DNS.Domain}} - Upstream: {{upstreamServers .DNS.Upstream}} + Upstream: {{printList .DNS.Upstream}} TTL: {{.DNS.TTL}} Entries: {{countDNSEntries .DNS.Entries}} {{end}}\