tsnet: set Hostinfo.Package to "tsnet" on use

Fixes #4256

Change-Id: I11276596c3724bead1e0aa1f2e57ba75cef3b6be
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/4286/head
Brad Fitzpatrick 3 years ago committed by Brad Fitzpatrick
parent b2f269d5b7
commit a0e345dba4

@ -107,8 +107,9 @@ func SetDeviceModel(model string) { deviceModelAtomic.Store(model) }
func SetOSVersion(v string) { osVersionAtomic.Store(v) }
// SetPackage sets the packaging type for the app.
// This is currently (2021-10-05) only used by Android,
// set to "nogoogle" for the F-Droid build.
//
// As of 2022-03-25, this is used by Android ("nogoogle" for the
// F-Droid build) and tsnet (set to "tsnet").
func SetPackage(v string) { packagingType.Store(v) }
func deviceModel() string {

@ -23,6 +23,7 @@ import (
"tailscale.com/client/tailscale"
"tailscale.com/control/controlclient"
"tailscale.com/envknob"
"tailscale.com/hostinfo"
"tailscale.com/ipn"
"tailscale.com/ipn/ipnlocal"
"tailscale.com/ipn/localapi"
@ -92,6 +93,7 @@ func (s *Server) Dial(ctx context.Context, network, address string) (net.Conn, e
// Start connects the server to the tailnet.
// Optional: any calls to Dial/Listen will also call Start.
func (s *Server) Start() error {
hostinfo.SetPackage("tsnet")
s.initOnce.Do(s.doInit)
return s.initErr
}
@ -116,7 +118,6 @@ func (s *Server) Close() error {
}
func (s *Server) doInit() {
s.shutdownCtx, s.shutdownCancel = context.WithCancel(context.Background())
if err := s.start(); err != nil {
s.initErr = fmt.Errorf("tsnet: %w", err)

Loading…
Cancel
Save