wgengine, magicsock, derp: misc cleanups, docs

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2020-02-18 08:57:11 -08:00
parent a23a0d9c9f
commit e06ca40650
4 changed files with 57 additions and 43 deletions

View File

@ -107,18 +107,14 @@ func newUserspaceEngineAdvanced(logf logger.Logf, tundev tun.Device, routerGen R
endpointsFn := func(endpoints []string) {
e.mu.Lock()
if e.endpoints != nil {
e.endpoints = e.endpoints[:0]
}
e.endpoints = append(e.endpoints, endpoints...)
e.endpoints = append(e.endpoints[:0], endpoints...)
e.mu.Unlock()
e.RequestStatus()
}
magicsockOpts := magicsock.Options{
Port: listenPort,
STUN: magicsock.DefaultSTUN,
// TODO(crawshaw): DERP: magicsock.DefaultDERP,
Port: listenPort,
STUN: magicsock.DefaultSTUN,
EndpointsFunc: endpointsFn,
}
e.magicConn, err = magicsock.Listen(magicsockOpts)