tailscale / tailscale/tailscale
Improve heuristics for endpoint selection in magicsock
- Dominant language
- Go
- Stars
- 36.5k
- Forks
- 3.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 123
Description
Currently (2023-05-08), the logic in magicsock that picks between two different addresses is fairly straightforward: pick the address with lower latency, with a preference for IPv6 addresses if the latency is roughly the same, and a recently-added change to add some hysteresis and avoid switching endpoints if there's a marginal improvement (#7940).
https://github.com/tailscale/tailscale/blob/e8b06b22323668b28ac4f950b8b8963922d4f8bf/wgengine/magicsock/magicsock.go#L5082-L5127
This address is used for sending WireGuard packets to the peer host (`de.bestAddr`):
https://github.com/tailscale/tailscale/blob/e8b06b22323668b28ac4f950b8b8963922d4f8bf/wgengine/magicsock/magicsock.go#L5032-L5053
This logic has served us well so far, however there are things that we may want to change. This is a tracking bug for any updates that we may want to make to this logic.
Similar to (but not the same as) #2331
Contributor guide
Assessment
This issue has not been assessed yet.