mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
health: add Warnable, move ownership of warnable items to callers
The health package was turning into a rando dumping ground. Make a new Warnable type instead that callers can request an instance of, and then Set it locally in their code without the health package being aware of all the things that are warnable. (For plenty of things the health package will want to know details of how Tailscale works so it can better prioritize/suppress errors, but lots of the warnings are pretty leaf-y and unrelated) This just moves two of the health warnings. Can probably move more later. Change-Id: I51e50e46eb633f4e96ced503d3b18a1891de1452 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
b1a6d8e2b1
commit
3f8e185003
@@ -1298,6 +1298,8 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var warnInvalidUnsignedNodes = health.NewWarnable()
|
||||
|
||||
// updateFilterLocked updates the packet filter in wgengine based on the
|
||||
// given netMap and user preferences.
|
||||
//
|
||||
@@ -1329,10 +1331,10 @@ func (b *LocalBackend) updateFilterLocked(netMap *netmap.NetworkMap, prefs ipn.P
|
||||
|
||||
if packetFilterPermitsUnlockedNodes(netMap.Peers, packetFilter) {
|
||||
err := errors.New("server sent invalid packet filter permitting traffic to unlocked nodes; rejecting all packets for safety")
|
||||
health.SetValidUnsignedNodes(err)
|
||||
warnInvalidUnsignedNodes.Set(err)
|
||||
packetFilter = nil
|
||||
} else {
|
||||
health.SetValidUnsignedNodes(nil)
|
||||
warnInvalidUnsignedNodes.Set(nil)
|
||||
}
|
||||
}
|
||||
if prefs.Valid() {
|
||||
|
Reference in New Issue
Block a user