config

package
v0.7.0-rc.13 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultDir  = paths.ConfigDir
	DefaultPath = paths.ConfigFile

	SystemSchema = 1
)
View Source
const (
	NetworkMainnet      = "mainnet"
	NetworkTestnet4     = "testnet4"
	NetworkPublicSignet = "public-signet"
)
View Source
const (
	PublicSignetGenesis   = "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6"
	PublicSignetChallenge = "" /* 142-byte string literal not displayed */
)

The public signet identity is part of the installation contract, not merely a command-line selector. A custom challenge must never be substituted here: any future controlled signet is a separate immutable profile.

View Source
const PreferencesSchema = 1

Variables

This section is empty.

Functions

func Save

func Save(cfg *AppConfig) error

func SavePreferences

func SavePreferences(prefs *Preferences) error

func SupportedNetworks

func SupportedNetworks() []string

SupportedNetworks returns the immutable profile identifiers in stable product order. The returned slice is a new value and may be modified by the caller without changing the profile table.

func ValidateNetwork

func ValidateNetwork(name string) error

Types

type AppConfig

type AppConfig struct {
	Schema           int    `json:"schema"`
	Network          string `json:"network"`
	PruneSize        int    `json:"prune_size_gb"`
	DbCache          int    `json:"db_cache_mb"`
	P2PMode          string `json:"p2p_mode"`
	P2PAddress       string `json:"p2p_address"`
	AutoUnlock       bool   `json:"auto_unlock_enabled"`
	SyncthingEnabled bool   `json:"syncthing_enabled"`
}

AppConfig is the root-owned, non-secret desired system configuration. It deliberately contains no live daemon observations, credentials, installer lifecycle state, security-workflow markers, or TUI preferences.

func Default

func Default() *AppConfig

func Load

func Load() (*AppConfig, error)

func (*AppConfig) DbCacheMB

func (c *AppConfig) DbCacheMB() int

func (*AppConfig) HasLND

func (c *AppConfig) HasLND() bool

LND is mandatory in the v0.7.0 base installation.

func (*AppConfig) NetworkConfig

func (c *AppConfig) NetworkConfig() (*NetworkConfig, error)

func (*AppConfig) Validate

func (c *AppConfig) Validate() error

type NetworkConfig

type NetworkConfig struct {
	Name                    string
	DisplayName             string
	TestingOnly             bool
	BitcoinFlag             string
	BitcoinCLIFlag          string
	CoreNetwork             string
	CoreDataDir             string
	ExpectedGenesis         string
	ExpectedSignetChallenge string
	LNDBitcoinFlag          string
	LNDNetwork              string
	RPCPort                 int
	P2PPort                 int
	ZMQBlockPort            int
	ZMQTxPort               int
	InvoicePrefix           string
	AddressPlaceholder      string
	InvoicePlaceholder      string
}

NetworkConfig is the closed, durable deployment profile shared by the installer, lifecycle authority, helpers, wrappers, and TUI. Name is VPN's immutable profile identifier. CoreNetwork and LNDNetwork are deliberately separate upstream identifiers: public-signet maps to "signet" in both daemons and must never use a /public-signet daemon-state directory.

func NetworkConfigFromName

func NetworkConfigFromName(name string) (*NetworkConfig, error)

func (*NetworkConfig) AcceptsInvoicePrefix

func (n *NetworkConfig) AcceptsInvoicePrefix(invoice string) bool

AcceptsInvoicePrefix distinguishes testnet4's lntb HRP from public signet's lntbs HRP. A plain HasPrefix check is unsafe because every lntbs invoice also begins with lntb. After the network prefix, BOLT11 permits either the bech32 separator (amountless invoice) or a decimal amount.

type Preferences

type Preferences struct {
	Schema int    `json:"schema"`
	Theme  string `json:"theme"`
}

func DefaultPreferences

func DefaultPreferences() *Preferences

func LoadPreferences

func LoadPreferences() (*Preferences, error)

func (*Preferences) Validate

func (p *Preferences) Validate() error

type PreferencesStore

type PreferencesStore struct {
	Dir  string
	Path string
}

func DefaultPreferencesStore

func DefaultPreferencesStore() (*PreferencesStore, error)

func (*PreferencesStore) Load

func (s *PreferencesStore) Load() (*Preferences, error)

func (*PreferencesStore) Save

func (s *PreferencesStore) Save(prefs *Preferences) error

type Store

type Store struct {
	Dir              string
	Path             string
	OwnerUID         int
	GroupGID         int
	GroupName        string
	RequireRootWrite bool
}

Store reads and atomically publishes one system-configuration file. The production store requires root for writes and resolves the vpn group at the moment of use. Tests use explicit numeric ownership under an isolated path.

func DefaultStore

func DefaultStore() *Store

func (*Store) Load

func (s *Store) Load() (*AppConfig, error)

func (*Store) Save

func (s *Store) Save(cfg *AppConfig) error

Save validates and atomically publishes the desired system configuration. The production store can only be written by root. The parent is verified as a real root-controlled directory, the existing destination (if any) must be the expected regular file, and the replacement is synchronized before and after rename.

Jump to

Keyboard shortcuts

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