Saves 86 KB.
And stop depending on expvar and usermetrics when disabled,
in prep to removing all the expvar/metrics/tsweb stuff.
Updates #12614
Change-Id: I35d2479ddd1d39b615bab32b1fa940ae8cbf9b11
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
returnfmt.Sprintf("An update from version %s to %s is available.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}else{
returnfmt.Sprintf("An update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.",args[ArgCurrentVersion],args[ArgAvailableVersion])
returnfmt.Sprintf("An update from version %s to %s is available.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}else{
returnfmt.Sprintf("An update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}
},
}
})
// securityUpdateAvailableWarnable is a Warnable that warns the user that an important security update is available.
returnfmt.Sprintf("A security update from version %s to %s is available.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}else{
returnfmt.Sprintf("A security update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.",args[ArgCurrentVersion],args[ArgAvailableVersion])
returnfmt.Sprintf("A security update from version %s to %s is available.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}else{
returnfmt.Sprintf("A security update from version %s to %s is available. Run `tailscale update` or `tailscale set --auto-update` to update now.",args[ArgCurrentVersion],args[ArgAvailableVersion])
}
},
}
})
// unstableWarnable is a Warnable that warns the user that they are using an unstable version of Tailscale
// so they won't be surprised by all the issues that may arise.
varunstableWarnable=Register(&Warnable{
Code:"is-using-unstable-version",
Title:"Using an unstable version",
Severity:SeverityLow,
Text:StaticMessage("This is an unstable version of Tailscale meant for testing and development purposes. Please report any issues to Tailscale."),
varunstableWarnable=condRegister(func()*Warnable{
return&Warnable{
Code:"is-using-unstable-version",
Title:"Using an unstable version",
Severity:SeverityLow,
Text:StaticMessage("This is an unstable version of Tailscale meant for testing and development purposes. Please report any issues to Tailscale."),
}
})
// NetworkStatusWarnable is a Warnable that warns the user that the network is down.
varNetworkStatusWarnable=Register(&Warnable{
Code:"network-status",
Title:"Network down",
Severity:SeverityMedium,
Text:StaticMessage("Tailscale cannot connect because the network is down. Check your Internet connection."),
Text:StaticMessage("Unable to connect to the Tailscale coordination server to synchronize the state of your tailnet. Peer reachability might degrade over time."),
// 8 minutes reflects a maximum maintenance window for the coordination server.
Text:StaticMessage("Unable to connect to the Tailscale coordination server to synchronize the state of your tailnet. Peer reachability might degrade over time."),
// 8 minutes reflects a maximum maintenance window for the coordination server.
TimeToVisible:8*time.Minute,
}
})
// noDERPHomeWarnable is a Warnable that warns the user that Tailscale doesn't have a home DERP.
varnoDERPHomeWarnable=Register(&Warnable{
Code:"no-derp-home",
Title:"No home relay server",
Severity:SeverityMedium,
DependsOn:[]*Warnable{NetworkStatusWarnable},
Text:StaticMessage("Tailscale could not connect to any relay server. Check your Internet connection."),
Text:StaticMessage("Tailscale could not connect to any relay server. Check your Internet connection."),
ImpactsConnectivity:true,
TimeToVisible:10*time.Second,
}
})
// noDERPConnectionWarnable is a Warnable that warns the user that Tailscale couldn't connect to a specific DERP server.
varnoDERPConnectionWarnable=Register(&Warnable{
Code:"no-derp-connection",
Title:"Relay server unavailable",
Severity:SeverityMedium,
DependsOn:[]*Warnable{
NetworkStatusWarnable,
// Technically noDERPConnectionWarnable could be used to warn about
// failure to connect to a specific DERP server (e.g. your home is derp1
// but you're trying to connect to a peer's derp4 and are unable) but as
// of 2024-09-25 we only use this for connecting to your home DERP, so
// we depend on noDERPHomeWarnable which is the ability to figure out
// what your DERP home even is.
noDERPHomeWarnable,
},
Text:func(argsArgs)string{
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])
// Technically noDERPConnectionWarnable could be used to warn about
// failure to connect to a specific DERP server (e.g. your home is derp1
// but you're trying to connect to a peer's derp4 and are unable) but as
// of 2024-09-25 we only use this for connecting to your home DERP, so
// we depend on noDERPHomeWarnable which is the ability to figure out
// what your DERP home even is.
noDERPHomeWarnable,
},
Text:func(argsArgs)string{
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])
}
},
ImpactsConnectivity:true,
TimeToVisible:10*time.Second,
}
})
// derpTimeoutWarnable is a Warnable that warns the user that Tailscale hasn't
// heard from the home DERP region for a while.
varderpTimeoutWarnable=Register(&Warnable{
Code:"derp-timed-out",
Title:"Relay server timed out",
Severity:SeverityMedium,
DependsOn:[]*Warnable{
NetworkStatusWarnable,
noDERPConnectionWarnable,// don't warn about it being stalled if we're not connected
noDERPHomeWarnable,// same reason as noDERPConnectionWarnable's dependency
},
Text:func(argsArgs)string{
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])
noDERPConnectionWarnable,// don't warn about it being stalled if we're not connected
noDERPHomeWarnable,// same reason as noDERPConnectionWarnable's dependency
},
Text:func(argsArgs)string{
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])
}
},
}
})
// derpRegionErrorWarnable is a Warnable that warns the user that a DERP region is reporting an issue.
varderpRegionErrorWarnable=Register(&Warnable{
Code:"derp-region-error",
Title:"Relay server error",
Severity:SeverityLow,
DependsOn:[]*Warnable{NetworkStatusWarnable},
Text:func(argsArgs)string{
returnfmt.Sprintf("The relay server #%v is reporting an issue: %v",args[ArgDERPRegionID],args[ArgError])