tailscale/health/args.go
Andrea Gottardo d6a8fb20e7
health: include DERP region name in bad derp notifications (#12530)
Fixes tailscale/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>
2024-06-18 16:03:17 -07:00

36 lines
1.5 KiB
Go

// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause
package health
// Arg is a type for the key to be used in the Args of a Warnable.
type Arg string
const (
// ArgAvailableVersion provides an update notification Warnable with the available version of the Tailscale client.
ArgAvailableVersion Arg = "available-version"
// ArgCurrentVersion provides an update notification Warnable with the current version of the Tailscale client.
ArgCurrentVersion Arg = "current-version"
// ArgDuration provides a Warnable with how long the Warnable has been in an unhealthy state.
ArgDuration Arg = "duration"
// ArgError provides a Warnable with the underlying error behind an unhealthy state.
ArgError Arg = "error"
// ArgMagicsockFunctionName provides a Warnable with the name of the Magicsock function that caused the unhealthy state.
ArgMagicsockFunctionName Arg = "magicsock-function-name"
// ArgDERPRegionID provides a Warnable with the ID of a DERP server involved in the unhealthy state.
ArgDERPRegionID Arg = "derp-region-id"
// ArgDERPRegionName provides a Warnable with the name of a DERP server involved in the unhealthy state.
// It is used to show a more friendly message like "the Seattle relay server failed to connect" versus
// "relay server 10 failed to connect".
ArgDERPRegionName Arg = "derp-region-name"
// ArgServerName provides a Warnable with the hostname of a server involved in the unhealthy state.
ArgServerName Arg = "server-name"
)