ran 'go fmt'; cosmetic changes
This commit is contained in:
1 parent
a113da0e34
commit
94e00e2c8e
4 files changed
+22
-21
No files matched your search
+15
-15
@@ -2,33 +2,33 @@ package weave
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
/* A simple http responder that will show the status of the router when asked,
|
||||
e.g. via http://172.17.0.2/status
|
||||
e.g. via http://172.17.0.2/status
|
||||
*/
|
||||
type HttpStatusResponder struct {
|
||||
router *Router
|
||||
router *Router
|
||||
}
|
||||
|
||||
func NewHttpStatusResponder(router *Router) *HttpStatusResponder {
|
||||
resp := &HttpStatusResponder{router}
|
||||
return resp
|
||||
resp := &HttpStatusResponder{router}
|
||||
return resp
|
||||
}
|
||||
|
||||
func (resp *HttpStatusResponder) SetRouter(newRouter *Router) {
|
||||
resp.router = newRouter
|
||||
resp.router = newRouter
|
||||
}
|
||||
|
||||
func (resp *HttpStatusResponder) ListenAndServe() {
|
||||
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
|
||||
if resp.router != nil {
|
||||
fmt.Fprint(w, resp.router.Status())
|
||||
} else {
|
||||
fmt.Fprintf(w, "Not initialized")
|
||||
}
|
||||
})
|
||||
address := fmt.Sprintf(":%d", StatusPort)
|
||||
http.ListenAndServe(address, nil)
|
||||
http.HandleFunc("/status", func(w http.ResponseWriter, r *http.Request) {
|
||||
if resp.router != nil {
|
||||
fmt.Fprint(w, resp.router.Status())
|
||||
} else {
|
||||
fmt.Fprintf(w, "Not initialized")
|
||||
}
|
||||
})
|
||||
address := fmt.Sprintf(":%d", StatusPort)
|
||||
http.ListenAndServe(address, nil)
|
||||
}
|
||||
Reference in new issue
Block a user