Documentation
¶
Overview ¶
Package store provides various implementation of ipn.StateStore.
Index ¶
- Constants
- func HasKnownProviderPrefix(path string) bool
- func New(logf logger.Logf, path string) (ipn.StateStore, error)
- func NewFileStore(logf logger.Logf, path string) (ipn.StateStore, error)
- func Register(prefix string, fn Provider)
- func RegisterForTest(t testenv.TB, prefix string, fn Provider)
- func TryWindowsAppDataMigration(logf logger.Logf, path string) string
- type ExportableStore
- type FileStore
- type Provider
Constants ¶
const TPMPrefix = "tpmseal:"
TPMPrefix is the path prefix used for TPM-encrypted StateStore.
Variables ¶
This section is empty.
Functions ¶
func HasKnownProviderPrefix ¶ added in v1.86.0
HasKnownProviderPrefix reports whether path uses one of the registered Provider prefixes.
func New ¶
New returns a StateStore based on the provided arg and registered stores. The arg is of the form "prefix:rest", where prefix was previously registered with Register.
By default the following stores are registered:
- if the string begins with "mem:", the suffix is ignored and an in-memory store is used.
- (Linux-only) if the string begins with "arn:", the suffix an AWS ARN for an SSM.
- (Linux-only) if the string begins with "kube:", the suffix is a Kubernetes secret name
- (Linux or Windows) if the string begins with "tpmseal:", the suffix is filepath that is sealed with the local TPM device.
- In all other cases, the path is treated as a filepath.
func NewFileStore ¶
NewFileStore returns a new file store that persists to path.
func Register ¶
Register registers a prefix to be used for NewStore. It panics if the prefix is empty, or if the prefix is already registered. The provided fn is called with the path passed to NewStore; the prefix is not stripped.
func RegisterForTest ¶ added in v1.86.0
RegisterForTest registers a prefix to be used for NewStore in tests. An existing registered prefix will be replaced.
func TryWindowsAppDataMigration ¶
TryWindowsAppDataMigration attempts to copy the Windows state file from its old location to the new location. (Issue 2856)
Tailscale 1.14 and before stored state under %LocalAppData% (usually "C:\WINDOWS\system32\config\systemprofile\AppData\Local" when tailscaled.exe is running as a non-user system service). However it is frequently cleared for almost any reason: Windows updates, System Restore, even various System Cleaner utilities.
Returns a string of the path to use for the state file. This will be a fallback %LocalAppData% path if migration fails, a %ProgramData% path otherwise.
Types ¶
type ExportableStore ¶ added in v1.86.0
type ExportableStore interface { ipn.StateStore // All returns an iterator over all store keys. Using ReadState or // WriteState is not safe while iterating and can lead to a deadlock. The // order of keys in the iterator is not specified and may change between // runs. All() iter.Seq2[ipn.StateKey, []byte] }
ExportableStore is an ipn.StateStore that can export all of its contents. This interface is optional to implement, and used for migrating the state between different store implementations.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is a StateStore that uses a JSON file for persistence.
Directories
¶
Path | Synopsis |
---|---|
Package awsstore contains an ipn.StateStore implementation using AWS SSM.
|
Package awsstore contains an ipn.StateStore implementation using AWS SSM. |
Package kubestore contains an ipn.StateStore implementation using Kubernetes Secrets.
|
Package kubestore contains an ipn.StateStore implementation using Kubernetes Secrets. |
Package mem provides an in-memory ipn.StateStore implementation.
|
Package mem provides an in-memory ipn.StateStore implementation. |