diff --git a/cmd/tailscale/cli/licenses.go b/cmd/tailscale/cli/licenses.go index 16b07d37d..65ac41aa1 100644 --- a/cmd/tailscale/cli/licenses.go +++ b/cmd/tailscale/cli/licenses.go @@ -19,24 +19,27 @@ var licensesCmd = &ffcli.Command{ Exec: runLicenses, } -func runLicenses(ctx context.Context, args []string) error { - var licenseURL string +// licensesURL returns the absolute URL containing open source license information for the current platform. +func licensesURL() string { switch runtime.GOOS { case "android": - licenseURL = "https://tailscale.com/licenses/android" + return "https://tailscale.com/licenses/android" case "darwin", "ios": - licenseURL = "https://tailscale.com/licenses/apple" + return "https://tailscale.com/licenses/apple" case "windows": - licenseURL = "https://tailscale.com/licenses/windows" + return "https://tailscale.com/licenses/windows" default: - licenseURL = "https://tailscale.com/licenses/tailscale" + return "https://tailscale.com/licenses/tailscale" } +} +func runLicenses(ctx context.Context, args []string) error { + licenses := licensesURL() outln(` Tailscale wouldn't be possible without the contributions of thousands of open source developers. To see the open source packages included in Tailscale and their respective license information, visit: - ` + licenseURL) + ` + licenses) return nil } diff --git a/cmd/tailscale/cli/web.go b/cmd/tailscale/cli/web.go index d53d1fda8..deef4b51d 100644 --- a/cmd/tailscale/cli/web.go +++ b/cmd/tailscale/cli/web.go @@ -59,6 +59,7 @@ type tmplData struct { IP string AdvertiseExitNode bool AdvertiseRoutes string + LicensesURL string } var webCmd = &ffcli.Command{ @@ -392,6 +393,7 @@ func webHandler(w http.ResponseWriter, r *http.Request) { Profile: profile, Status: st.BackendState, DeviceName: deviceName, + LicensesURL: licensesURL(), } exitNodeRouteV4 := netip.MustParsePrefix("0.0.0.0/0") exitNodeRouteV6 := netip.MustParsePrefix("::/0") diff --git a/cmd/tailscale/cli/web.html b/cmd/tailscale/cli/web.html index 429708cf8..76ff6f3eb 100644 --- a/cmd/tailscale/cli/web.html +++ b/cmd/tailscale/cli/web.html @@ -11,7 +11,7 @@ -
+
@@ -100,6 +100,9 @@ {{ end }}
+