mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-07 08:07:42 +00:00
wgengine/magicsock: skip netcheck if external STUN aren't in use
Updates #146 (not a complete fix yet probably)
This commit is contained in:
parent
fe0051fafd
commit
fbab12c94c
@ -247,8 +247,23 @@ func (c *Conn) epUpdate(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Conn) hasExternalSTUN() bool {
|
||||||
|
for _, hp := range c.stunServers {
|
||||||
|
if strings.Contains(hp, ".com:") {
|
||||||
|
// matches stun.l.google.com:19302 or derp\d+.tailscale.com:nnnn
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Conn) updateNetInfo() {
|
func (c *Conn) updateNetInfo() {
|
||||||
logf := logger.WithPrefix(c.logf, "updateNetInfo: ")
|
logf := logger.WithPrefix(c.logf, "updateNetInfo: ")
|
||||||
|
if !c.hasExternalSTUN() {
|
||||||
|
logf("skipping in non-production mode")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user