mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 02:21:58 +00:00
net/portmapper: add logs about obtained mapping(s)
This logs additional information about what mapping(s) are obtained during the creation process, including whether we return an existing cached mapping. Updates #10597 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I9ff25071f064c91691db9ab0b9365ccc5f948d6e
This commit is contained in:
@@ -68,9 +68,16 @@ type upnpMapping struct {
|
||||
// https://github.com/tailscale/tailscale/issues/7377
|
||||
const upnpProtocolUDP = "UDP"
|
||||
|
||||
func (u *upnpMapping) MappingType() string { return "upnp" }
|
||||
func (u *upnpMapping) GoodUntil() time.Time { return u.goodUntil }
|
||||
func (u *upnpMapping) RenewAfter() time.Time { return u.renewAfter }
|
||||
func (u *upnpMapping) External() netip.AddrPort { return u.external }
|
||||
func (u *upnpMapping) MappingDebug() string {
|
||||
return fmt.Sprintf("upnpMapping{gw:%v, external:%v, internal:%v, renewAfter:%d, goodUntil:%d, loc:%q}",
|
||||
u.gw, u.external, u.internal,
|
||||
u.renewAfter.Unix(), u.goodUntil.Unix(),
|
||||
u.loc)
|
||||
}
|
||||
func (u *upnpMapping) Release(ctx context.Context) {
|
||||
u.client.DeletePortMapping(ctx, "", u.external.Port(), upnpProtocolUDP)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user