Help us shape the future of Go! Take the 2026 Go Developer Survey

state

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package state persists the agent's identity between runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

type State struct {
	PrivateKey     wgkey.Key `json:"privateKey"`
	CoordinatorURL string    `json:"coordinatorURL,omitempty"`
	NodeID         string    `json:"nodeID,omitempty"`
	NodeToken      string    `json:"nodeToken,omitempty"`
	Name           string    `json:"name,omitempty"`
	// Address is the node's mesh address (CIDR). Userspace mode needs it
	// before the first netmap arrives.
	Address string `json:"address,omitempty"`
}

State is everything the agent must remember across restarts.

func Load

func Load(dir string) (*State, error)

Load reads the state from dir, generating a fresh private key if no state file exists yet.

func (*State) Registered

func (s *State) Registered(coordinatorURL string) bool

Registered reports whether the node holds a token for coordinatorURL.

func (*State) Save

func (s *State) Save(dir string) error

Save atomically writes the state to dir with owner-only permissions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL