Rebind for MacOS (#1816)

Co-authored-by: Jack Doan <me@jackdoan.com>
This commit is contained in:
Nate Brown
2026-07-23 09:26:24 -05:00
committed by GitHub
parent c2fbe215e6
commit 7902ce674e
15 changed files with 951 additions and 41 deletions
+9 -1
View File
@@ -53,6 +53,7 @@ type Control struct {
statsStart func()
dnsStart func()
lighthouseStart func()
networkChangeStart func(rebind func())
connectionManagerStart func(context.Context)
}
@@ -104,6 +105,9 @@ func (c *Control) Start() error {
if c.dnsStart != nil {
go c.dnsStart()
}
if c.networkChangeStart != nil {
go c.networkChangeStart(c.RebindUDPServer)
}
if c.connectionManagerStart != nil {
go c.connectionManagerStart(c.ctx)
}
@@ -198,7 +202,11 @@ func (c *Control) RebindUDPServer() {
return
}
_ = c.f.outside.Rebind()
// A failure here means we are likely still pinned to the interface we came up on, so the rest of this is
// unlikely to help. Say so instead of silently carrying on as if we rebound.
if err := c.f.outside.Rebind(); err != nil {
c.l.Error("Failed to rebind udp socket", "error", err)
}
// Trigger a lighthouse update, useful for mobile clients that should have an update interval of 0
c.f.lightHouse.SendUpdate()