From 3909c82f3d8922a4a5ad5b5ffe40562decdd634f Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 20 Oct 2020 10:40:52 -0700 Subject: [PATCH] control/controlclient: rename map debug knob, make it do both request+response Signed-off-by: Brad Fitzpatrick --- control/controlclient/direct.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index 93bc3dcec..bec6377cf 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -781,7 +781,7 @@ func decode(res *http.Response, v interface{}, serverKey *wgcfg.Key, mkey *wgcfg return decodeMsg(msg, v, serverKey, mkey) } -var dumpMapResponse, _ = strconv.ParseBool(os.Getenv("TS_DEBUG_MAPRESPONSE")) +var debugMap, _ = strconv.ParseBool(os.Getenv("TS_DEBUG_MAP")) func (c *Direct) decodeMsg(msg []byte, v interface{}) error { c.mu.Lock() @@ -806,7 +806,7 @@ func (c *Direct) decodeMsg(msg []byte, v interface{}) error { return err } } - if dumpMapResponse { + if debugMap { var buf bytes.Buffer json.Indent(&buf, b, "", " ") log.Printf("MapResponse: %s", buf.Bytes()) @@ -850,8 +850,7 @@ func encode(v interface{}, serverKey *wgcfg.Key, mkey *wgcfg.PrivateKey) ([]byte if err != nil { return nil, err } - const debugMapRequests = false - if debugMapRequests { + if debugMap { if _, ok := v.(tailcfg.MapRequest); ok { log.Printf("MapRequest: %s", b) }