Documentation
¶
Index ¶
- Constants
- func ApplyCoreChannelSidecar(settings *Settings, sidecarPath string) (bool, error)
- func AtomicWrite(path string, content []byte, mode os.FileMode) error
- func LoadOrCreateWithSidecarOutcome(path, sidecar string) (settings Settings, created bool, result CommitResult, err error)
- func Save(path string, settings Settings) error
- type CommitResult
- type LoggingSettings
- type RoutingSettings
- type Settings
- func (s Settings) Clone() Settings
- func (s Settings) EffectiveLogging() LoggingSettings
- func (s Settings) GlobalSelection(id string) string
- func (s Settings) RoutingMode() string
- func (s *Settings) SetGlobalSelection(id, name string)
- func (s *Settings) SetLogging(logging LoggingSettings)
- func (s *Settings) SetRoutingMode(mode string)
- func (s Settings) Validate() error
Constants ¶
const ( // DefaultLogLevel is the persisted logging level used without an override. DefaultLogLevel = "info" // DefaultLogMaxSizeMB is the active log rotation limit in MiB used without an override. DefaultLogMaxSizeMB int64 = 10 // DefaultLogMaxFiles is the retained file count used without an override. DefaultLogMaxFiles int64 = 3 )
Variables ¶
This section is empty.
Functions ¶
func ApplyCoreChannelSidecar ¶ added in v0.5.0
ApplyCoreChannelSidecar applies a packaged core-channel sidecar to settings. A missing or invalid sidecar is ignored. An unchanged stamp is a no-op so a later TUI channel switch is not reverted by an old sidecar file.
func LoadOrCreateWithSidecarOutcome ¶ added in v0.9.2
func LoadOrCreateWithSidecarOutcome(path, sidecar string) (settings Settings, created bool, result CommitResult, err error)
LoadOrCreateWithSidecarOutcome loads or creates settings and reports the outcome of any write.
Types ¶
type CommitResult ¶ added in v0.9.2
CommitResult describes whether an atomic settings write crossed its replace commit point.
func AtomicWriteWithCommit ¶ added in v0.9.2
AtomicWriteWithCommit atomically replaces path and reports whether replacement committed.
func SaveWithCommit ¶ added in v0.9.2
func SaveWithCommit(path string, settings Settings) (CommitResult, error)
SaveWithCommit validates and canonically persists settings without modifying its argument.
type LoggingSettings ¶ added in v0.9.2
type LoggingSettings struct {
Level string `yaml:"level"`
MaxSizeMB int64 `yaml:"max-size-mb"`
MaxFiles int64 `yaml:"max-files"`
}
LoggingSettings controls the level and retention limits for Mihari file logs.
func DefaultLoggingSettings ¶ added in v0.9.2
func DefaultLoggingSettings() LoggingSettings
DefaultLoggingSettings returns the logging configuration used when no override is persisted.
type RoutingSettings ¶ added in v0.9.4
type RoutingSettings struct {
Mode string `yaml:"mode"`
GlobalSelections map[string]string `yaml:"global-selections,omitempty"`
BootstrapGlobal string `yaml:"bootstrap-global,omitempty"`
}
RoutingSettings stores global routing intent and subscription-scoped exits.
type Settings ¶
type Settings struct {
Routing *RoutingSettings `yaml:"routing,omitempty"`
Schema string `yaml:"schema"`
MixedAddr string `yaml:"mixed-addr"`
ControllerAddr string `yaml:"controller-addr"`
WebAddr string `yaml:"web-addr"`
ControllerSecret string `yaml:"controller-secret"`
SystemProxyDesired bool `yaml:"system-proxy-desired,omitempty"`
Tun map[string]any `yaml:"tun,omitempty"` // managed block; empty = unmanaged
CoreChannel string `yaml:"core-channel,omitempty"`
CoreChannelBundle string `yaml:"core-channel-bundle,omitempty"`
Logging *LoggingSettings `yaml:"log,omitempty"`
}
func LoadOrCreate ¶
func LoadOrCreateResult ¶
LoadOrCreateResult loads settings or creates them and reports whether this call created the file.
func LoadOrCreateWithSidecar ¶ added in v0.5.0
LoadOrCreateWithSidecar loads settings or creates them, applying a packaged core-channel sidecar. On first create the sidecar is applied before the first Save so the file is never written as a stable-only default and then rewritten.
func (Settings) Clone ¶ added in v0.9.2
Clone returns a copy of Settings that does not share mutable YAML values.
func (Settings) EffectiveLogging ¶ added in v0.9.2
func (s Settings) EffectiveLogging() LoggingSettings
EffectiveLogging returns logging settings with omitted and zero-valued fields defaulted.
func (Settings) GlobalSelection ¶ added in v0.9.4
GlobalSelection returns the exit saved for one subscription (empty means bootstrap).
func (Settings) RoutingMode ¶ added in v0.9.4
RoutingMode returns the effective daemon-owned mode, defaulting to rule.
func (*Settings) SetGlobalSelection ¶ added in v0.9.4
SetGlobalSelection records an exit without changing the routing mode.
func (*Settings) SetLogging ¶ added in v0.9.2
func (s *Settings) SetLogging(logging LoggingSettings)
SetLogging stores a complete non-default logging override or removes the default override.
func (*Settings) SetRoutingMode ¶ added in v0.9.4
SetRoutingMode records mode without changing saved exits.