mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-11-04 00:55:11 +00:00 
			
		
		
		
	control/controlclient: note package type in Hostinfo
Fixes tailscale/corp#440
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
(cherry picked from commit 4ec01323c1)
			
			
This commit is contained in:
		@@ -22,6 +22,7 @@ import (
 | 
				
			|||||||
	"net/url"
 | 
						"net/url"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
 | 
						"path/filepath"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
	"sort"
 | 
						"sort"
 | 
				
			||||||
@@ -230,10 +231,25 @@ func NewHostinfo() *tailcfg.Hostinfo {
 | 
				
			|||||||
		Hostname:   hostname,
 | 
							Hostname:   hostname,
 | 
				
			||||||
		OS:         version.OS(),
 | 
							OS:         version.OS(),
 | 
				
			||||||
		OSVersion:  osv,
 | 
							OSVersion:  osv,
 | 
				
			||||||
 | 
							Package:    packageType(),
 | 
				
			||||||
		GoArch:     runtime.GOARCH,
 | 
							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
 | 
					// SetHostinfo clones the provided Hostinfo and remembers it for the
 | 
				
			||||||
// next update. It reports whether the Hostinfo has changed.
 | 
					// next update. It reports whether the Hostinfo has changed.
 | 
				
			||||||
func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {
 | 
					func (c *Direct) SetHostinfo(hi *tailcfg.Hostinfo) bool {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user