diagnostics: AppendUnique(), restructure sets, add metrics, fix bugs

This commit is contained in:
Matthew Holt
2018-02-10 12:59:23 -07:00
parent 703cf7bf8b
commit 6b3c2212a1
10 changed files with 141 additions and 82 deletions
+9
View File
@@ -24,6 +24,8 @@ import (
"strconv"
"strings"
"sync"
"github.com/mholt/caddy/diagnostics"
)
// tlsHandler is a http.Handler that will inject a value
@@ -97,6 +99,13 @@ func (h *tlsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if checked {
r = r.WithContext(context.WithValue(r.Context(), MitmCtxKey, mitm))
if mitm {
go diagnostics.AppendUnique("mitm", "likely")
} else {
go diagnostics.AppendUnique("mitm", "unlikely")
}
} else {
go diagnostics.AppendUnique("mitm", "unknown")
}
if mitm && h.closeOnMITM {