From 4ec01323c135c44f4f85acd8e2330a8e8542de71 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 15 Feb 2021 13:23:11 -0800 Subject: [PATCH] control/controlclient: note package type in Hostinfo Fixes tailscale/corp#440 Signed-off-by: Brad Fitzpatrick --- control/controlclient/direct.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/control/controlclient/direct.go b/control/controlclient/direct.go index ed36dd502..1328af09e 100644 --- a/control/controlclient/direct.go +++ b/control/controlclient/direct.go @@ -20,6 +20,7 @@ import ( "net/url" "os" "os/exec" + "path/filepath" "reflect" "runtime" "sort" @@ -172,10 +173,25 @@ func NewHostinfo() *tailcfg.Hostinfo { Hostname: hostname, OS: version.OS(), OSVersion: osv, + Package: packageType(), GoArch: runtime.GOARCH, } } +func packageType() string { + switch runtime.GOOS { + case "windows": + if _, err := os.Stat(`C:\ProgramData\chocolatey\lib\tailscale`); err == nil { + return "choco" + } + case "darwin": + // Using tailscaled or IPNExtension? + exe, _ := os.Executable() + return filepath.Base(exe) + } + return "" +} + // SetHostinfo clones the provided Hostinfo and remembers it for the // next update. It reports whether the Hostinfo has changed. func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {