config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config holds Phase 3 daemon TOML settings (library layer; daemon owns persistence).

Index

Constants

This section is empty.

Variables

View Source
var RestartRequiredKeys = []string{
	"listen_addr", "quic_listen_addr", "bootstrap", "api_addr", "key_dir",
	"disable_upnp", "fallback_host", "min_observed_peers",
	"ice_signal_url", "ice_stun_urls", "ice_turn_urls", "ice_publish_turns",
}

RestartRequiredKeys lists config keys that need daemon restart after change.

Functions

func ApplyEnv

func ApplyEnv(c *Config)

ApplyEnv overlays known A2AL_* variables (subset).

func Save

func Save(path string, c Config) error

Save writes c to path as TOML (0644) via a temp-file rename for atomicity.

Types

type Config

type Config struct {
	ListenAddr       string   `toml:"listen_addr" json:"listen_addr"`
	QUICListenAddr   string   `toml:"quic_listen_addr" json:"quic_listen_addr"`
	Bootstrap        []string `toml:"bootstrap" json:"bootstrap"`
	DisableUPnP      bool     `toml:"disable_upnp" json:"disable_upnp"`
	FallbackHost     string   `toml:"fallback_host" json:"fallback_host"`
	MinObservedPeers int      `toml:"min_observed_peers" json:"min_observed_peers"`
	APIAddr          string   `toml:"api_addr" json:"api_addr"`
	APIToken         string   `toml:"api_token" json:"api_token"`
	KeyDir           string   `toml:"key_dir" json:"key_dir"`
	LogFormat        string   `toml:"log_format" json:"log_format"`
	LogLevel         string   `toml:"log_level" json:"log_level"`

	ICESignalURL    string   `toml:"ice_signal_url" json:"ice_signal_url"`
	ICESTUNURLs     []string `toml:"ice_stun_urls" json:"ice_stun_urls"`
	ICETURNURLs     []string `toml:"ice_turn_urls" json:"ice_turn_urls"`
	ICEPublishTurns []string `toml:"ice_publish_turns" json:"ice_publish_turns"`
	// AutoPublish controls whether the daemon publishes the node identity to the DHT
	// on startup and on a schedule (default true). When false, the node stays off the DHT
	// as a discoverable endpoint while still participating in routing.
	AutoPublish bool `toml:"auto_publish" json:"auto_publish"`
}

Config is the a2ald configuration (spec Phase 3).

func Default

func Default() Config

Default returns a copy with zero values filled to spec defaults.

func LoadFile

func LoadFile(path string) (Config, error)

LoadFile reads TOML from path into a new Config merged over Default().

func (*Config) KeyDirOrDefault

func (c *Config) KeyDirOrDefault(dataDir string) string

KeyDirOrDefault returns the directory for node.key; empty KeyDir means <dataDir>/keys.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if fields are invalid.

Jump to

Keyboard shortcuts

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