ipn/ipnlocal: use routecheck reports to make exit node suggestions
Now that the routecheck subsystem is continuously collecting reachability reports in the background, we can add a hook to LocalBackend for fetching its report. That allows suggestExitNodeUsingTrafficSteering to consult that report when disqualifying candidates, instead of blocking on an immediate probe. Exit node suggestions will only consult the report when the `client-side-reachability` and `client-side-reachability-routecheck` node attributes are both set on the current node. Updates #17366 Updates tailscale/corp#33033 Signed-off-by: Simon Law <sfllaw@tailscale.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
"sync"
|
||||
|
||||
"tailscale.com/ipn/ipnext"
|
||||
"tailscale.com/ipn/ipnlocal"
|
||||
"tailscale.com/net/routecheck"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/logger"
|
||||
@@ -36,6 +37,8 @@ func init() {
|
||||
backend: b,
|
||||
}, nil
|
||||
})
|
||||
|
||||
ipnlocal.HookRouteCheckReport.Set(routeCheckReport)
|
||||
}
|
||||
|
||||
// Extension implements the [ipnext.Extension] interface.
|
||||
@@ -162,3 +165,15 @@ func (e *Extension) reconcileLoop() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func routeCheckReport(b *ipnlocal.LocalBackend) ipnlocal.RouteCheckReport {
|
||||
c := ClientFor(b)
|
||||
if c == nil {
|
||||
return nil
|
||||
}
|
||||
r := c.Report()
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user