net/portmapper: log upnp information

This logs some basic statistics for UPnP, so that tailscale can better understand what routers
are being used and how to connect to them.

Signed-off-by: julianknodt <julianknodt@gmail.com>
This commit is contained in:
julianknodt
2021-08-10 14:50:33 -07:00
committed by Julian Knodt
parent 26b6fe7f02
commit b9bd7dbc5d
3 changed files with 15 additions and 1 deletions

View File

@@ -714,7 +714,10 @@ func (c *Client) Probe(ctx context.Context) (res ProbeResult, err error) {
res.UPnP = true
c.mu.Lock()
c.uPnPSawTime = time.Now()
c.uPnPMeta = meta
if c.uPnPMeta != meta {
c.logf("UPnP meta changed: %+v", meta)
c.uPnPMeta = meta
}
c.mu.Unlock()
}
case c.pxpPort(): // same value for PMP and PCP