mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-14 23:17:29 +00:00
tailcfg, net/portmapper, wgengine/magicsock: add NetInfo.HavePortMap
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
79d8288f0a
commit
ef7bac2895
@@ -63,6 +63,13 @@ type Client struct {
|
||||
pmpMapping *pmpMapping // non-nil if we have a PMP mapping
|
||||
}
|
||||
|
||||
// HaveMapping reports whether we have a current valid mapping.
|
||||
func (c *Client) HaveMapping() bool {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
return c.pmpMapping != nil && c.pmpMapping.useUntil.After(time.Now())
|
||||
}
|
||||
|
||||
// pmpMapping is an already-created PMP mapping.
|
||||
//
|
||||
// All fields are immutable once created.
|
||||
|
Reference in New Issue
Block a user