diff --git a/prog/weaver/main.go b/prog/weaver/main.go index c5105051..c9b2679a 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -226,11 +226,6 @@ func determineQuorum(initPeerCountFlag int, peers []string) uint { } func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator) { - encryption := "off" - if router.UsingPassword() { - encryption = "on" - } - muxRouter := mux.NewRouter() if allocator != nil { @@ -239,7 +234,6 @@ func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator muxRouter.Methods("GET").Path("/status").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { fmt.Fprintln(w, "weave router", version) - fmt.Fprintln(w, "Encryption", encryption) fmt.Fprintln(w, router.Status()) if allocator != nil { fmt.Fprintln(w, allocator.String()) @@ -247,7 +241,7 @@ func handleHTTP(router *weave.Router, httpAddr string, allocator *ipam.Allocator }) muxRouter.Methods("GET").Path("/status-json").HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - json, _ := router.StatusJSON(version, encryption) + json, _ := router.StatusJSON(version) w.Write(json) }) diff --git a/router/json.go b/router/json.go index 786e0d36..24eef73f 100644 --- a/router/json.go +++ b/router/json.go @@ -6,10 +6,10 @@ import ( "time" ) -func (router *Router) StatusJSON(version, encryption string) ([]byte, error) { +func (router *Router) StatusJSON(version string) ([]byte, error) { return json.Marshal(struct { Version string - Encryption string + Encryption bool Name string NickName string Interface string @@ -17,7 +17,7 @@ func (router *Router) StatusJSON(version, encryption string) ([]byte, error) { Peers *Peers Routes *Routes ConnectionMakerStatus - }{version, encryption, router.Ourself.Name.String(), router.Ourself.NickName, fmt.Sprintf("%v", router.Iface), router.Macs, router.Peers, router.Routes, router.ConnectionMaker.Status()}) + }{version, router.UsingPassword(), router.Ourself.Name.String(), router.Ourself.NickName, fmt.Sprintf("%v", router.Iface), router.Macs, router.Peers, router.Routes, router.ConnectionMaker.Status()}) } func (cache *MacCache) MarshalJSON() ([]byte, error) { diff --git a/router/router.go b/router/router.go index 8bebe9e8..15699205 100644 --- a/router/router.go +++ b/router/router.go @@ -112,8 +112,13 @@ func (router *Router) UsingPassword() bool { } func (router *Router) Status() string { + encryption := "off" + if router.UsingPassword() { + encryption = "on" + } var buf bytes.Buffer fmt.Fprintln(&buf, "Our name is", router.Ourself) + fmt.Fprintln(&buf, "Encryption", encryption) fmt.Fprintln(&buf, "Sniffing traffic on", router.Iface) fmt.Fprintf(&buf, "MACs:\n%s", router.Macs) fmt.Fprintf(&buf, "Peers:\n%s", router.Peers) diff --git a/site/troubleshooting.md b/site/troubleshooting.md index bc968e6d..8b9d64d3 100644 --- a/site/troubleshooting.md +++ b/site/troubleshooting.md @@ -61,8 +61,8 @@ This produces output like: ```` weave router 0.7.0 -Encryption off Our name is 7a:f4:56:87:76:3b(weave01) +Encryption off Sniffing traffic on &{39 65535 ethwe ae:e3:07:9c:8c:d4 up|broadcast|multicast} MACs: ba:8c:b9:dc:e1:c9 -> 7a:f4:56:87:76:3b(weave01) (2014-10-23 16:39:19.482338935 +0000 UTC)