Movatterモバイル変換


[0]ホーム

URL:


store

package
v1.92.2Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:19Imported by:14

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package store provides various implementation of ipn.StateStore.

Index

Constants

View Source
const TPMPrefix = "tpmseal:"

TPMPrefix is the path prefix used for TPM-encrypted StateStore.

Variables

This section is empty.

Functions

funcHasKnownProviderPrefixadded inv1.86.0

func HasKnownProviderPrefix(pathstring)bool

HasKnownProviderPrefix reports whether path uses one of the registeredProvider prefixes.

funcNew

func New(logflogger.Logf, pathstring) (ipn.StateStore,error)

New returns a StateStore based on the provided argand registered stores.The arg is of the form "prefix:rest", where prefix was previouslyregistered with Register.

By default the following stores are registered:

  • if the string begins with "mem:", the suffixis 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 isfilepath that is sealed with the local TPM device.
  • In all other cases, the path is treated as a filepath.

funcNewFileStore

func NewFileStore(logflogger.Logf, pathstring) (ipn.StateStore,error)

NewFileStore returns a new file store that persists to path.

funcRegister

func Register(prefixstring, fnProvider)

Register registers a prefix to be used forNewStore. It panics if the prefix is empty, or if theprefix is already registered.The provided fn is called with the path passed to NewStore;the prefix is not stripped.

funcRegisterForTestadded inv1.86.0

func RegisterForTest(ttestenv.TB, prefixstring, fnProvider)

RegisterForTest registers a prefix to be used for NewStore in tests. Anexisting registered prefix will be replaced.

funcTryWindowsAppDataMigration

func TryWindowsAppDataMigration(logflogger.Logf, pathstring)string

TryWindowsAppDataMigration attempts to copy the Windows state filefrom 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: Windowsupdates, 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

typeExportableStoreadded inv1.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 statebetween different store implementations.

typeFileStore

type FileStore struct {// contains filtered or unexported fields}

FileStore is a StateStore that uses a JSON file for persistence.

func (*FileStore)Alladded inv1.86.0

func (s *FileStore) All()iter.Seq2[ipn.StateKey, []byte]

func (*FileStore)Path

func (s *FileStore) Path()string

Path returns the path that NewFileStore was called with.

func (*FileStore)ReadState

func (s *FileStore) ReadState(idipn.StateKey) ([]byte,error)

ReadState implements the StateStore interface.

func (*FileStore)String

func (s *FileStore) String()string

func (*FileStore)WriteState

func (s *FileStore) WriteState(idipn.StateKey, bs []byte)error

WriteState implements the StateStore interface.

typeProvider

type Provider func(logflogger.Logf, argstring) (ipn.StateStore,error)

Provider returns a StateStore for the provided path.The arg is of the form "prefix:rest", where prefix was previously registered with Register.

Source Files

View all Source files

Directories

PathSynopsis
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp