From 5cf9eedf42e883437eba2d793700747e00ff3674 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Mon, 15 Aug 2022 10:43:39 +0200 Subject: [PATCH] Minor logging corrections --- noise.go | 2 +- protocol_common_poll.go | 7 ++++--- utils.go | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/noise.go b/noise.go index 16754c69..c3800576 100644 --- a/noise.go +++ b/noise.go @@ -58,7 +58,7 @@ func (h *Headscale) NoiseUpgradeHandler( server.Handler = h2c.NewHandler(h.noiseMux, &http2.Server{}) err = server.Serve(netutil.NewOneConnListener(noiseConn, nil)) if err != nil { - log.Error().Err(err).Msg("noise server launch failed") + log.Info().Err(err).Msg("The HTTP2 server was closed") } } diff --git a/protocol_common_poll.go b/protocol_common_poll.go index 11178cd3..f8265d38 100644 --- a/protocol_common_poll.go +++ b/protocol_common_poll.go @@ -18,6 +18,8 @@ type contextKey string const machineNameContextKey = contextKey("machineName") +// handlePollCommon is the common code for the legacy and Noise protocols to +// managed the poll loop. func (h *Headscale) handlePollCommon( writer http.ResponseWriter, req *http.Request, @@ -37,7 +39,6 @@ func (h *Headscale) handlePollCommon( log.Error(). Caller(). Bool("noise", isNoise). - Str("func", "handleAuthKey"). Str("machine", machine.Hostname). Err(err) } @@ -246,13 +247,13 @@ func (h *Headscale) pollNetMapStream( ) log.Trace(). - Str("handler", "PollNetMapStream"). + Str("handler", "pollNetMapStream"). Bool("noise", isNoise). Str("machine", machine.Hostname). Msg("Waiting for data to stream...") log.Trace(). - Str("handler", "PollNetMapStream"). + Str("handler", "pollNetMapStream"). Bool("noise", isNoise). Str("machine", machine.Hostname). Msgf("pollData is %#v, keepAliveChan is %#v, updateChan is %#v", pollDataChan, keepAliveChan, updateChan) diff --git a/utils.go b/utils.go index 089e867b..7727a245 100644 --- a/utils.go +++ b/utils.go @@ -118,7 +118,10 @@ func decode( pubKey *key.MachinePublic, privKey *key.MachinePrivate, ) error { - log.Trace().Int("length", len(msg)).Msg("Trying to decrypt") + log.Trace(). + Str("pubkey", pubKey.ShortString()). + Int("length", len(msg)). + Msg("Trying to decrypt") decrypted, ok := privKey.OpenFrom(*pubKey, msg) if !ok {