|
|
@@ -7,8 +7,6 @@ package localapi
|
|
|
import (
|
|
|
"bytes"
|
|
|
"context"
|
|
|
- "crypto/rand"
|
|
|
- "encoding/hex"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
@@ -49,6 +47,7 @@ import (
|
|
|
"tailscale.com/util/httpm"
|
|
|
"tailscale.com/util/mak"
|
|
|
"tailscale.com/util/osdiag"
|
|
|
+ "tailscale.com/util/rands"
|
|
|
"tailscale.com/version"
|
|
|
)
|
|
|
|
|
|
@@ -118,12 +117,6 @@ var handler = map[string]localAPIHandler{
|
|
|
"query-feature": (*Handler).serveQueryFeature,
|
|
|
}
|
|
|
|
|
|
-func randHex(n int) string {
|
|
|
- b := make([]byte, n)
|
|
|
- rand.Read(b)
|
|
|
- return hex.EncodeToString(b)
|
|
|
-}
|
|
|
-
|
|
|
var (
|
|
|
// The clientmetrics package is stateful, but we want to expose a simple
|
|
|
// imperative API to local clients, so we need to keep track of
|
|
|
@@ -318,7 +311,7 @@ func (h *Handler) serveBugReport(w http.ResponseWriter, r *http.Request) {
|
|
|
defer h.b.TryFlushLogs() // kick off upload after bugreport's done logging
|
|
|
|
|
|
logMarker := func() string {
|
|
|
- return fmt.Sprintf("BUG-%v-%v-%v", h.backendLogID, h.clock.Now().UTC().Format("20060102150405Z"), randHex(8))
|
|
|
+ return fmt.Sprintf("BUG-%v-%v-%v", h.backendLogID, h.clock.Now().UTC().Format("20060102150405Z"), rands.HexString(16))
|
|
|
}
|
|
|
if envknob.NoLogsNoSupport() {
|
|
|
logMarker = func() string { return "BUG-NO-LOGS-NO-SUPPORT-this-node-has-had-its-logging-disabled" }
|