cmd/tailscaled: use state key constant from ipn package

Rather than redefining it again.

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2021-07-19 14:14:24 -07:00
parent e2eaae8224
commit ec4d721572

View File

@ -28,6 +28,7 @@
"time" "time"
"github.com/go-multierror/multierror" "github.com/go-multierror/multierror"
"tailscale.com/ipn"
"tailscale.com/ipn/ipnserver" "tailscale.com/ipn/ipnserver"
"tailscale.com/logpolicy" "tailscale.com/logpolicy"
"tailscale.com/net/dns" "tailscale.com/net/dns"
@ -45,15 +46,6 @@
"tailscale.com/wgengine/router" "tailscale.com/wgengine/router"
) )
// globalStateKey is the ipn.StateKey that tailscaled loads on
// startup.
//
// We have to support multiple state keys for other OSes (Windows in
// particular), but right now Unix daemons run with a single
// node-global state. To keep open the option of having per-user state
// later, the global state key doesn't look like a username.
const globalStateKey = "_daemon"
// defaultTunName returns the default tun device name for the platform. // defaultTunName returns the default tun device name for the platform.
func defaultTunName() string { func defaultTunName() string {
switch runtime.GOOS { switch runtime.GOOS {
@ -275,7 +267,7 @@ func run() error {
SocketPath: args.socketpath, SocketPath: args.socketpath,
Port: 41112, Port: 41112,
StatePath: args.statepath, StatePath: args.statepath,
AutostartStateKey: globalStateKey, AutostartStateKey: ipn.GlobalDaemonStateKey,
SurviveDisconnects: runtime.GOOS != "windows", SurviveDisconnects: runtime.GOOS != "windows",
DebugMux: debugMux, DebugMux: debugMux,
} }