mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 12:16:44 +02:00
ipn,control: adds node not found to ipn.Notify
Updates #18700 Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
parent
0bac4223d1
commit
5ba62d2832
@ -157,6 +157,12 @@ type Notify struct {
|
||||
// any changes to the user in the UI.
|
||||
Health *health.State `json:",omitzero"`
|
||||
|
||||
// NodeRemoved, if non-nil, indicates that this node has been removed
|
||||
// from the tailnet by the control plane. When set, the value is a
|
||||
// message describing why the node was removed (e.g., "node not found",
|
||||
// "node deleted by admin", etc.)
|
||||
NodeRemoved *string `json:",omitzero"`
|
||||
|
||||
// SuggestedExitNode, if non-nil, is the node that the backend has determined to
|
||||
// be the best exit node for the current network conditions.
|
||||
SuggestedExitNode *tailcfg.StableNodeID `json:",omitzero"`
|
||||
@ -203,6 +209,9 @@ func (n Notify) String() string {
|
||||
if n.SuggestedExitNode != nil {
|
||||
fmt.Fprintf(&sb, "SuggestedExitNode=%v ", *n.SuggestedExitNode)
|
||||
}
|
||||
if n.NodeRemoved != nil {
|
||||
fmt.Fprintf(&sb, "nodeRemoved=%q ", *n.NodeRemoved)
|
||||
}
|
||||
|
||||
s := sb.String()
|
||||
if s == "Notify{" {
|
||||
|
||||
@ -1583,6 +1583,11 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
|
||||
return
|
||||
}
|
||||
b.logf("Received error: %v", st.Err)
|
||||
errMsg := st.Err.Error()
|
||||
if strings.Contains(errMsg, "404") && strings.Contains(errMsg, "node not found") {
|
||||
reason := "This node has been removed from the tailnet"
|
||||
b.sendLocked(ipn.Notify{NodeRemoved: &reason})
|
||||
}
|
||||
var uerr controlclient.UserVisibleError
|
||||
if errors.As(st.Err, &uerr) {
|
||||
s := uerr.UserVisibleError()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user