Health server runs on 127.0.0.1:9999, fix #272

This commit is contained in:
Quentin McGaw
2020-10-27 03:28:25 +00:00
parent 78d83145ba
commit edc08c46d4
9 changed files with 173 additions and 54 deletions

View File

@@ -64,9 +64,7 @@ func (s *server) Run(ctx context.Context, wg *sync.WaitGroup) {
func (s *server) makeHandler() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if s.logging && (r.Method != http.MethodGet || r.RequestURI != "/health") {
s.logger.Info("HTTP %s %s", r.Method, r.RequestURI)
}
s.logger.Info("HTTP %s %s", r.Method, r.RequestURI)
switch r.Method {
case http.MethodGet:
switch r.RequestURI {
@@ -80,8 +78,6 @@ func (s *server) makeHandler() http.HandlerFunc {
s.handleGetPortForwarded(w)
case "/openvpn/settings":
s.handleGetOpenvpnSettings(w)
case "/health":
s.handleHealth(w)
case "/updater/restart":
s.updaterLooper.Restart()
w.WriteHeader(http.StatusOK)