paths: remove wasm file, no-op stubs, make OS-specific funcs consistent
Some OS-specific funcs were defined in init. Another used build tags and required all other OSes to stub it out. Another one could just be in the portable file. Simplify it a bit, removing a file and some stubs in the process. Updates #5794 Change-Id: I51df8772cc60a9335ac4c1dc0ab59b8a0d236961 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
d58ba59fd5
commit
a5dcc4c87b
@ -45,7 +45,14 @@ func DefaultTailscaledSocket() string {
|
||||
return "tailscaled.sock"
|
||||
}
|
||||
|
||||
var stateFileFunc func() string
|
||||
// Overridden in init by OS-specific files.
|
||||
var (
|
||||
stateFileFunc func() string
|
||||
|
||||
// ensureStateDirPerms applies a restrictive ACL/chmod
|
||||
// to the provided directory.
|
||||
ensureStateDirPerms = func(string) error { return nil }
|
||||
)
|
||||
|
||||
// DefaultTailscaledStateFile returns the default path to the
|
||||
// tailscaled state file, or the empty string if there's no reasonable
|
||||
@ -67,6 +74,16 @@ func MkStateDir(dirPath string) error {
|
||||
if err := os.MkdirAll(dirPath, 0700); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ensureStateDirPerms(dirPath)
|
||||
}
|
||||
|
||||
// LegacyStateFilePath returns the legacy path to the state file when
|
||||
// it was stored under the current user's %LocalAppData%.
|
||||
//
|
||||
// It is only called on Windows.
|
||||
func LegacyStateFilePath() string {
|
||||
if runtime.GOOS == "windows" {
|
||||
return filepath.Join(os.Getenv("LocalAppData"), "Tailscale", "server-state.conf")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Reference in New Issue
Block a user