Fixestailscale/corp#20971
We added some Warnables for DERP failure situations, but their Text currently spits out the DERP region ID ("10") in the UI, which is super ugly. It would be better to provide the RegionName of the DERP region that is failing. We can do so by storing a reference to the last-known DERP map in the health package whenever we fetch one, and using it when generating the notification text.
This way, the following message...
> Tailscale could not connect to the relay server '10'. The server might be temporarily unavailable, or your Internet connection might be down.
becomes:
> Tailscale could not connect to the 'Seattle' relay server. The server might be temporarily unavailable, or your Internet connection might be down.
which is a lot more user-friendly.
Signed-off-by: Andrea Gottardo <andrea@gottardo.me>
@ -103,11 +103,15 @@ var noDERPHomeWarnable = Register(&Warnable{
// noDERPConnectionWarnable is a Warnable that warns the user that Tailscale couldn't connect to a specific DERP server.
// noDERPConnectionWarnable is a Warnable that warns the user that Tailscale couldn't connect to a specific DERP server.
varnoDERPConnectionWarnable=Register(&Warnable{
varnoDERPConnectionWarnable=Register(&Warnable{
Code:"no-derp-connection",
Code:"no-derp-connection",
Title:"No relay server connection",
Title:"Relay server unavailable",
Severity:SeverityHigh,
Severity:SeverityHigh,
DependsOn:[]*Warnable{NetworkStatusWarnable},
DependsOn:[]*Warnable{NetworkStatusWarnable},
Text:func(argsArgs)string{
Text:func(argsArgs)string{
returnfmt.Sprintf("Tailscale could not connect to the relay server '%s'. The server might be temporarily unavailable, or your Internet connection might be down.",args[ArgRegionID])
ifn:=args[ArgDERPRegionName];n!=""{
returnfmt.Sprintf("Tailscale could not connect to the '%s' relay server. Your Internet connection might be down, or the server might be temporarily unavailable.",n)
}else{
returnfmt.Sprintf("Tailscale could not connect to the relay server with ID '%s'. Your Internet connection might be down, or the server might be temporarily unavailable.",args[ArgDERPRegionID])
}
},
},
})
})
@ -118,7 +122,11 @@ var derpTimeoutWarnable = Register(&Warnable{
Severity:SeverityMedium,
Severity:SeverityMedium,
DependsOn:[]*Warnable{NetworkStatusWarnable},
DependsOn:[]*Warnable{NetworkStatusWarnable},
Text:func(argsArgs)string{
Text:func(argsArgs)string{
returnfmt.Sprintf("Tailscale hasn't heard from the home relay server (region %v) in %v. The server might be temporarily unavailable, or your Internet connection might be down.",args[ArgRegionID],args[ArgDuration])
ifn:=args[ArgDERPRegionName];n!=""{
returnfmt.Sprintf("Tailscale hasn't heard from the '%s' relay server in %v. The server might be temporarily unavailable, or your Internet connection might be down.",n,args[ArgDuration])
}else{
returnfmt.Sprintf("Tailscale hasn't heard from the home relay server (region ID '%v') in %v. The server might be temporarily unavailable, or your Internet connection might be down.",args[ArgDERPRegionID],args[ArgDuration])
}
},
},
})
})
@ -129,7 +137,7 @@ var derpRegionErrorWarnable = Register(&Warnable{
Severity:SeverityMedium,
Severity:SeverityMedium,
DependsOn:[]*Warnable{NetworkStatusWarnable},
DependsOn:[]*Warnable{NetworkStatusWarnable},
Text:func(argsArgs)string{
Text:func(argsArgs)string{
returnfmt.Sprintf("The relay server #%v is reporting an issue: %v",args[ArgRegionID],args[ArgError])
returnfmt.Sprintf("The relay server #%v is reporting an issue: %v",args[ArgDERPRegionID],args[ArgError])