config

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package config loads optional YAML settings and backend definitions for honey.

Index

Constants

This section is empty.

Variables

View Source
var MustInventoryValue = hosts.MustInventoryValue

MustInventoryValue is for tests and static literals.

Functions

func BuildJSONSchema added in v0.2.8

func BuildJSONSchema() map[string]any

BuildJSONSchema returns a JSON Schema payload generated from the UI schema.

func DefaultPluginsDir added in v0.2.9

func DefaultPluginsDir() string

DefaultPluginsDir returns ~/.config/honey/plugins (or XDG_CONFIG_HOME/honey/plugins).

func DefaultRecipesDirs added in v0.2.6

func DefaultRecipesDirs() []string

DefaultRecipesDirs returns the list of directories to check for default CUE recipes.

func DefaultRecordDir added in v0.2.8

func DefaultRecordDir(configPath string) string

DefaultRecordDir returns the directory used for session recordings when --record-dir is not set: <directory of config.yaml>/records (e.g. ~/.config/honey/records). If configPath is empty, returns the conventional honey config directory (.../honey/records) matching default config.yaml search paths.

func ListDefaultRecipes added in v0.2.6

func ListDefaultRecipes() []string

ListDefaultRecipes returns a list of absolute paths to all .cue files found in the default recipe directories.

func ParseBytes added in v0.2.8

func ParseBytes(s string) (int64, error)

ParseBytes converts a size string ("5GiB", "64MiB", "1024") into bytes. Accepted suffixes (case-insensitive): KiB, MiB, GiB, TiB. Bare integers are taken as bytes. Fractional values and SI suffixes (KB, MB, …) are rejected.

func ParseRetentionDuration added in v0.3.0

func ParseRetentionDuration(s string) (time.Duration, error)

ParseRetentionDuration parses a retention duration (supports Go durations and day suffix, e.g. 30d).

func ResolvePath

func ResolvePath(explicit string) (string, error)

ResolvePath returns an explicit path from --config or HONEY_CONFIG then the first existing default file, or "" if none exist.

func ResolvePolicyDir added in v0.3.6

func ResolvePolicyDir(cfg *File) string

ResolvePolicyDir returns the policy directory for OPA evaluation. Precedence: HONEY_POLICY_DIR environment variable > defaults.policy_dir from config > empty.

func ResolveRecordDir added in v0.2.8

func ResolveRecordDir(cfg *File, configPath string, recordDirFlag string, recordDirFlagChanged bool) string

ResolveRecordDir returns the session recordings directory (CLI TUI, web server, cue-exec). Precedence when recordDirFlagChanged is true: non-empty global --record-dir value, otherwise DefaultRecordDir(configPath) (explicit empty flag keeps the default path). When recordDirFlagChanged is false: defaults.record_dir from cfg if set, otherwise DefaultRecordDir(configPath).

func ResolveStateDir added in v0.3.1

func ResolveStateDir() (string, error)

ResolveStateDir returns a safe path for writing runtime state files. It prefers XDG_STATE_HOME if set, otherwise ~/.local/state/honey, or falls back to the user's home directory.

func Set added in v0.3.6

func Set(cfg *File)

Set updates the global configuration object.

Types

type AWSBackend

type AWSBackend struct {
	Name           string         `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Profile        string         `yaml:"profile" json:"profile" honey:"label=Profile" validate:"required" mod:"trim"`
	Region         string         `yaml:"region,omitempty" json:"region,omitempty" honey:"label=Region" mod:"trim"`
	DockerDiscover DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover"`
}

AWSBackend configures one Amazon EC2 listing.

type AlertMapping added in v0.3.3

type AlertMapping struct {
	MatchLabels map[string]string `yaml:"match_labels" json:"match_labels"`
	// HostQuery is a Go template evaluated against alert labels to produce a honey search query.
	// Example: "{{.cluster}}" resolves the cluster label to a substring host search.
	HostQuery string       `yaml:"host_query" json:"host_query"`
	Recipe    string       `yaml:"recipe,omitempty" json:"recipe,omitempty"`
	Command   string       `yaml:"command,omitempty" json:"command,omitempty"`
	Notify    *AlertNotify `yaml:"notify,omitempty" json:"notify,omitempty"`
}

AlertMapping maps Prometheus alert labels to a honey host query and optional investigation config.

type AlertNotify added in v0.3.3

type AlertNotify struct {
	Subject  string               `yaml:"subject,omitempty" json:"subject,omitempty"`
	Slack    *AlertNotifySlack    `yaml:"slack,omitempty" json:"slack,omitempty"`
	HTTP     *AlertNotifyHTTP     `yaml:"http,omitempty" json:"http,omitempty"`
	Telegram *AlertNotifyTelegram `yaml:"telegram,omitempty" json:"telegram,omitempty"`
}

AlertNotify holds optional notification config for alert investigation findings.

type AlertNotifyHTTP added in v0.3.3

type AlertNotifyHTTP struct {
	URL     string            `yaml:"url" json:"url"`
	Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"`
}

AlertNotifyHTTP configures HTTP POST notifications for alert findings.

type AlertNotifySlack added in v0.3.3

type AlertNotifySlack struct {
	WebhookURL string `yaml:"webhook_url" json:"webhook_url"`
	ChannelID  string `yaml:"channel_id,omitempty" json:"channel_id,omitempty"`
}

AlertNotifySlack configures Slack notifications for alert findings.

type AlertNotifyTelegram added in v0.3.3

type AlertNotifyTelegram struct {
	BotToken string   `yaml:"bot_token,omitempty" json:"bot_token,omitempty"`
	ChatIDs  []string `yaml:"chat_ids,omitempty" json:"chat_ids,omitempty"`
}

AlertNotifyTelegram configures Telegram notifications for alert findings.

type AlertWebhookConfig added in v0.3.3

type AlertWebhookConfig struct {
	Enabled         bool   `yaml:"enabled" json:"enabled"`
	Port            int    `yaml:"port" json:"port"`
	Token           string `yaml:"token,omitempty" json:"token,omitempty"`
	AutoInvestigate bool   `yaml:"auto_investigate" json:"auto_investigate"`
	DedupWindow     string `yaml:"dedup_window,omitempty" json:"dedup_window,omitempty"`
	DedupCapacity   int    `yaml:"dedup_capacity,omitempty" json:"dedup_capacity,omitempty"`
}

AlertWebhookConfig configures the Alertmanager webhook receiver server.

type Audit added in v0.3.6

type Audit struct {
	Enabled bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	Path    string `yaml:"path,omitempty" json:"path,omitempty"`
}

Audit configures the append-only JSONL audit event log. When Enabled is false (the default), no audit file is written and the sink is a no-op.

func (Audit) EffectivePath added in v0.3.6

func (a Audit) EffectivePath() string

EffectivePath returns the resolved audit log path, expanding a leading "~" to the user home directory. Falls back to ~/.honey/audit.jsonl when Path is unset.

type BackendRow

type BackendRow struct {
	Kind string `json:"kind"`
	Name string `json:"name,omitempty"`
	Hint string `json:"hint,omitempty"`
}

BackendRow describes one YAML backends.* entry (for CLI / MCP listing).

type BackendSchema added in v0.2.8

type BackendSchema struct {
	Label  string        `json:"label"`
	Fields []SchemaField `json:"fields"`
}

BackendSchema describes one backend kind and its field layout.

type Backends

type Backends struct {
	GCP        []GCPBackend        `yaml:"gcp" json:"gcp" honey:"label=Google Cloud;order=10" validate:"dive" mod:"dive"`
	AWS        []AWSBackend        `yaml:"aws" json:"aws" honey:"label=AWS;order=20" validate:"dive" mod:"dive"`
	Kubernetes []KubernetesBackend `yaml:"kubernetes" json:"kubernetes" honey:"label=Kubernetes;order=30" validate:"dive" mod:"dive"`
	Consul     []ConsulBackend     `yaml:"consul" json:"consul" honey:"label=Consul;order=40" validate:"dive" mod:"dive"`
	Proxmox    []ProxmoxBackend    `yaml:"proxmox" json:"proxmox" honey:"label=Proxmox;order=50" validate:"dive" mod:"dive"`
	TrueNAS    []TrueNASBackend    `yaml:"truenas" json:"truenas" honey:"label=TrueNAS;order=55" validate:"dive" mod:"dive"`
	Local      []LocalBackend      `yaml:"local" json:"local" honey:"label=Local;order=60" validate:"dive" mod:"dive"`
	Honey      []HoneyBackend      `yaml:"honey" json:"honey" honey:"label=Honey (Remote);order=65" validate:"dive" mod:"dive"`
	Docker     []DockerBackend     `yaml:"docker" json:"docker" honey:"label=Docker;order=35" validate:"dive" mod:"dive"`
}

Backends lists optional multiple instances per provider type. If a slice is nil or omitted, that provider is not defined by the file (use CLI defaults). If a slice is non-empty, one backend is created per element.

type ConsulBackend

type ConsulBackend struct {
	Name           string         `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Addr           string         `yaml:"addr" json:"addr" honey:"label=Address" validate:"required,url" mod:"trim"`
	Datacenter     string         `yaml:"datacenter,omitempty" json:"datacenter,omitempty" honey:"label=Datacenter" mod:"trim"`
	Token          string         `yaml:"token,omitempty" json:"token,omitempty" honey:"label=Token;secret" mod:"trim"`
	DockerDiscover DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover"`
}

ConsulBackend configures one HashiCorp Consul catalog listing.

type Defaults

type Defaults struct {
	SSHUser         string         `yaml:"ssh_user" json:"ssh_user" honey:"label=SSH user" mod:"trim"`
	CacheTTL        string         `yaml:"cache_ttl" json:"cache_ttl" honey:"label=Cache TTL" mod:"trim"` // e.g. "5m", "1h"
	K8sMode         string         `yaml:"k8s_mode" json:"k8s_mode" honey:"label=Kubernetes mode;enum=nodes|pods;enum_as_warning" mod:"trim"`
	K8sDebugImage   string         `yaml:"k8s_debug_image" json:"k8s_debug_image" honey:"label=Kubernetes debug image" mod:"trim"`
	CacheDir        string         `yaml:"cache_dir" json:"cache_dir" honey:"label=Cache directory" mod:"trim"`
	RecordDir       string         `yaml:"record_dir" json:"record_dir" honey:"label=Session recordings directory" mod:"trim"`
	RecordRetention string         `` /* 144-byte string literal not displayed */
	ExecTimeout     string         `yaml:"exec_timeout" json:"exec_timeout" honey:"label=Per-host command timeout (e.g. 30s, 5m); empty disables" mod:"trim"`
	Output          string         `yaml:"output" json:"output" honey:"label=Output;enum=table|json|tui;enum_as_warning" mod:"trim"` // e.g. "table", "json", "tui" (default)
	Name            string         `yaml:"name" json:"name" honey:"label=Name filter" mod:"trim"`
	NameRegex       string         `yaml:"name_regex" json:"name_regex" honey:"label=Name regex" mod:"trim"`
	PolicyDir       string         `yaml:"policy_dir" json:"policy_dir" honey:"label=Policy directory" mod:"trim"`
	AISystemPrompt  string         `yaml:"ai_system_prompt" json:"ai_system_prompt" honey:"label=Default system prompt for CUE recipe ai step" mod:"trim"`
	DockerDiscover  DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover Defaults"`
	Logs            Logs           `yaml:"logs,omitempty" json:"logs,omitempty" honey:"label=Logs command defaults"`
	Studio          StudioConfig   `yaml:"studio,omitempty" json:"studio,omitempty" honey:"label=Studio defaults"`

	// secretsprovider unwraps the stack AES data key (see internal/cuetry/secrets/doc.go).
	// Examples: gcpkms://projects/…/cryptoKeys/…, awskms://, vault-transit://mount/key,
	// k8s://namespace/secret, keyring://service/user, age://, age-file://path.
	SecretsProvider string `` /* 146-byte string literal not displayed */
	// encryptedkey is provider-specific ciphertext or field name (see secrets package doc).
	EncryptedKey string `` /* 130-byte string literal not displayed */
}

Defaults apply when CLI flags are unset.

func (Defaults) DefaultsCacheTTL

func (d Defaults) DefaultsCacheTTL() (time.Duration, bool, error)

DefaultsCacheTTL parses Defaults.CacheTTL or returns empty and ok=false.

func (Defaults) DefaultsRecordRetention added in v0.3.0

func (d Defaults) DefaultsRecordRetention() (time.Duration, bool, error)

DefaultsRecordRetention parses Defaults.RecordRetention or returns empty and ok=false.

func (Defaults) ExecTimeoutDuration added in v0.3.6

func (d Defaults) ExecTimeoutDuration() time.Duration

ExecTimeoutDuration parses Defaults.ExecTimeout into a duration; returns 0 (no timeout) when empty or unparseable.

type DockerBackend added in v0.3.0

type DockerBackend struct {
	Name          string       `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Host          string       `` /* 135-byte string literal not displayed */
	ViaLocal      string       `` /* 126-byte string literal not displayed */
	ViaSSH        DockerViaSSH `yaml:"via_ssh,omitempty" json:"via_ssh,omitempty" honey:"label=SSH hop (overrides via_local when host set)"`
	Socket        string       `` /* 133-byte string literal not displayed */
	Platform      string       `` /* 135-byte string literal not displayed */
	RunAs         string       `` /* 126-byte string literal not displayed */
	Mode          string       `yaml:"mode" json:"mode" honey:"label=Mode;enum=containers|swarm|both;enum_as_warning;default=containers" mod:"trim"`
	AllContainers bool         `yaml:"all_containers" json:"all_containers" honey:"label=Include stopped containers;default=false"`
	TLSVerify     bool         `yaml:"tls_verify" json:"tls_verify" honey:"label=Verify TLS (tcp hosts);default=true"`
	CACert        string       `yaml:"ca_cert,omitempty" json:"ca_cert,omitempty" honey:"label=CA certificate path" mod:"trim"`
	Cert          string       `yaml:"cert,omitempty" json:"cert,omitempty" honey:"label=Client certificate path" mod:"trim"`
	Key           string       `yaml:"key,omitempty" json:"key,omitempty" honey:"label=Client key path;secret" mod:"trim"`
}

DockerBackend configures one Docker Engine API endpoint (local socket, tcp, ssh://, or Honey SSH).

type DockerDiscover added in v0.3.0

type DockerDiscover struct {
	Enabled  bool   `yaml:"enabled" json:"enabled" honey:"label=Enable auto-discover"`
	RunAs    string `yaml:"run_as,omitempty" json:"run_as,omitempty" honey:"label=Remote user for docker.sock via sudo (e.g. root)" mod:"trim"`
	Socket   string `yaml:"socket,omitempty" json:"socket,omitempty" honey:"label=Remote Docker socket" mod:"trim"`
	Platform string `yaml:"platform,omitempty" json:"platform,omitempty" honey:"label=Remote OS;enum=linux|windows" mod:"trim"`
}

DockerDiscover configures auto-discovery of containers on cloud VMs.

type DockerViaSSH added in v0.3.0

type DockerViaSSH struct {
	Host         string `yaml:"host,omitempty" json:"host,omitempty" honey:"label=SSH host" mod:"trim"`
	Port         int    `yaml:"port,omitempty" json:"port,omitempty" honey:"label=SSH port (0 = ssh_config default)"`
	User         string `yaml:"user,omitempty" json:"user,omitempty" honey:"label=SSH user" mod:"trim"`
	IdentityFile string `yaml:"identity_file,omitempty" json:"identity_file,omitempty" honey:"label=SSH identity file" mod:"trim"`
}

DockerViaSSH configures an explicit SSH hop for Honey's SSH stack (not Moby ssh://).

type File

type File struct {
	Version       int                `yaml:"version" json:"version"`
	Inventory     Inventory          `yaml:"inventory,omitempty" json:"inventory,omitempty"`
	Defaults      Defaults           `yaml:"defaults" json:"defaults"`
	Backends      Backends           `yaml:"backends" json:"backends"`
	Transfer      TransferConfig     `yaml:"transfer" json:"transfer"`
	Plugins       Plugins            `yaml:"plugins,omitempty" json:"plugins,omitempty"`
	Apps          apps.Config        `yaml:"apps,omitempty" json:"apps,omitempty"`
	AlertMappings []AlertMapping     `yaml:"alert_mappings,omitempty" json:"alert_mappings,omitempty"`
	AlertWebhook  AlertWebhookConfig `yaml:"alert_webhook,omitempty" json:"alert_webhook,omitempty"`
	Audit         Audit              `yaml:"audit,omitempty" json:"audit,omitempty"`
	SMTP          *SMTPConfig        `yaml:"smtp,omitempty" json:"smtp,omitempty"`
	Mesh          MeshConfig         `yaml:"mesh,omitempty" json:"mesh,omitempty"`
}

File is the optional honey YAML configuration.

func Get added in v0.3.6

func Get() *File

Get returns the current global configuration object. If none is set, returns an empty config.

func Load

func Load(path string) (*File, error)

Load reads and parses a YAML config file using viper. The returned *File is populated from the YAML file, with any HONEY_* environment variables able to override individual fields (e.g. HONEY_DEFAULTS_SSH_USER).

func ParseYAML added in v0.2.7

func ParseYAML(b []byte) (*File, error)

ParseYAML parses a honey config document from memory (used by web API PUT validation).

func (*File) HasAnyBackend

func (f *File) HasAnyBackend() bool

HasAnyBackend returns true if the file defines at least one backend entry.

func (*File) Sanitize added in v0.3.3

func (f *File) Sanitize()

Sanitize trims whitespace from all string fields tagged with mod:"trim". Called automatically by Load and ParseYAML before Validate.

func (*File) Save added in v0.2.6

func (f *File) Save(path string) error

Save serializes the config and writes it to path.

func (*File) Validate added in v0.2.9

func (f *File) Validate() error

Validate checks the configuration struct recursively according to validate tags.

type GCPBackend

type GCPBackend struct {
	Name           string         `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Project        string         `yaml:"project" json:"project" honey:"label=Project" validate:"required" mod:"trim"`
	Zone           string         `yaml:"zone,omitempty" json:"zone,omitempty" honey:"label=Zone" mod:"trim"`
	DockerDiscover DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover"`
}

GCPBackend configures one Google Cloud Compute Engine listing.

type HoneyBackend added in v0.3.6

type HoneyBackend struct {
	Name     string `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	URL      string `yaml:"url" json:"url" honey:"label=Honey Server URL" validate:"required" mod:"trim"`
	Token    string `yaml:"token,omitempty" json:"token,omitempty" honey:"label=Auth Token;secret" mod:"trim"`
	Insecure bool   `yaml:"insecure" json:"insecure" honey:"label=Insecure TLS;default=false"`
	// MTLS marks this backend as managed by the device mTLS client (the mobile app
	// fetches it over a client cert). The in-process honeyprovider skips it to
	// avoid a double-fetch; the app owns it. See examples/mtls/apisix.
	MTLS bool `yaml:"mtls,omitempty" json:"mtls,omitempty" honey:"label=Client-cert (mTLS) managed;default=false"`
	// ServerCA optionally pins the gateway server certificate (PEM) the mTLS
	// client trusts. Empty falls back to the enrolled device CA.
	ServerCA string `yaml:"server_ca,omitempty" json:"server_ca,omitempty" honey:"label=Gateway server CA (PEM);secret" mod:"trim"`
	// Mesh routes this backend's URL through the local libp2p mesh client
	// (internal/meshnet) instead of the normal network path — for reaching a
	// remote honey instance behind NAT/CGNAT with no port-forward. Requires
	// Config.Mesh.Enabled on this process, with at least one relay
	// configured in Config.Mesh.RelayAddrs.
	Mesh bool `yaml:"mesh,omitempty" json:"mesh,omitempty" honey:"label=Route via mesh;default=false"`
	// MeshAddr is the libp2p multiaddr to dial when Mesh is true — the actual
	// network target, e.g. a direct peer address or a full Circuit Relay v2
	// path (relay + target peer ID). URL is still used for building this
	// backend's request paths (e.g. "/api/v1/search") via plain string
	// concatenation — its host component is never actually resolved for a
	// mesh-routed backend, since the real dial is intercepted and redirected
	// to MeshAddr instead. Required when Mesh is true.
	MeshAddr string `` /* 129-byte string literal not displayed */
}

HoneyBackend configures a remote honey server backend.

type Inventory added in v0.3.6

type Inventory struct {
	Vars   map[string]InventoryValue `yaml:"vars,omitempty" json:"vars,omitempty" honey:"label=Global variables"`
	Groups map[string]InventoryGroup `yaml:"groups,omitempty" json:"groups,omitempty" honey:"label=Groups"`
	Hosts  map[string]InventoryHost  `yaml:"hosts,omitempty" json:"hosts,omitempty" honey:"label=Hosts"`
}

Inventory defines global variables and dynamic group matching rules.

type InventoryGroup added in v0.3.6

type InventoryGroup struct {
	Priority int                       `yaml:"priority" json:"priority" honey:"label=Priority"`
	Match    string                    `yaml:"match" json:"match" honey:"label=CEL match expression" mod:"trim"`
	Vars     map[string]InventoryValue `yaml:"vars,omitempty" json:"vars,omitempty" honey:"label=Variables"`
}

InventoryGroup defines variables applied to hosts matching a CEL expression.

type InventoryHost added in v0.3.6

type InventoryHost struct {
	Vars map[string]InventoryValue `yaml:"vars,omitempty" json:"vars,omitempty" honey:"label=Variables"`
}

InventoryHost defines variables for a specific host.

type InventoryValue added in v0.3.6

type InventoryValue = hosts.InventoryValue

InventoryValue is a scalar inventory variable value.

type KubernetesBackend

type KubernetesBackend struct {
	Name       string `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Context    string `yaml:"context,omitempty" json:"context,omitempty" honey:"label=Context" mod:"trim"`
	Kubeconfig string `yaml:"kubeconfig,omitempty" json:"kubeconfig,omitempty" honey:"label=Kubeconfig path" mod:"trim"`
	Mode       string `yaml:"mode" json:"mode" honey:"label=Mode;enum=nodes|pods;enum_as_warning;default=nodes" mod:"trim"`
	DebugImage string `yaml:"debug_image,omitempty" json:"debug_image,omitempty" honey:"label=Debug image" mod:"trim"`
}

KubernetesBackend configures one Kubernetes nodes/pods listing.

type LocalBackend added in v0.2.9

type LocalBackend struct {
	Name           string         `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	Hosts          []LocalHost    `yaml:"hosts" json:"hosts" honey:"label=Hosts" validate:"dive" mod:"dive"`
	DockerDiscover DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover"`
}

LocalBackend configures manually defined host lists.

type LocalHost added in v0.2.9

type LocalHost struct {
	Name      string            `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	PrimaryIP string            `yaml:"primary_ip" json:"primary_ip" honey:"label=Primary IP" validate:"required,ip" mod:"trim"`
	ExtraIPs  []string          `yaml:"extra_ips,omitempty" json:"extra_ips,omitempty" honey:"label=Extra IPs" validate:"dive,ip"`
	Zone      string            `yaml:"zone,omitempty" json:"zone,omitempty" honey:"label=Zone" mod:"trim"`
	Region    string            `yaml:"region,omitempty" json:"region,omitempty" honey:"label=Region" mod:"trim"`
	SSHUser   string            `yaml:"ssh_user,omitempty" json:"ssh_user,omitempty" honey:"label=SSH user for host" mod:"trim"`
	Meta      map[string]string `yaml:"meta,omitempty" json:"meta,omitempty" honey:"label=Metadata"`
}

LocalHost represents a manually defined static server.

type Logs added in v0.3.2

type Logs struct {
	Anomaly                bool    `yaml:"anomaly"                     json:"anomaly"                     honey:"label=Enable anomaly detection"`
	AnomalyModel           string  `yaml:"anomaly_model,omitempty"     json:"anomaly_model,omitempty"     honey:"label=Path to ONNX model file" mod:"trim"`
	AnomalyThresh          float64 `` /* 129-byte string literal not displayed */
	AnomalyWindow          int     `yaml:"anomaly_window,omitempty"    json:"anomaly_window,omitempty"    honey:"label=Anomaly sliding window size"`
	AnomalyOnly            bool    `yaml:"anomaly_only"                json:"anomaly_only"                honey:"label=Only output anomalous lines"`
	AnomalyStrict          bool    `yaml:"anomaly_strict"              json:"anomaly_strict"              honey:"label=Fail if anomaly detector cannot init"`
	AnomalyTokPath         string  `` /* 129-byte string literal not displayed */
	AnomalyEndpoint        string  `` /* 209-byte string literal not displayed */
	AnomalyLLMModel        string  `` /* 155-byte string literal not displayed */
	AnomalyContextLines    int     `` /* 176-byte string literal not displayed */
	AnomalyFilterThreshold float64 `` /* 179-byte string literal not displayed */
	AnomalyFreqWindow      int     `` /* 186-byte string literal not displayed */
	AnomalyFreqRatio       float64 `` /* 187-byte string literal not displayed */
	AnomalyFeedbackFile    string  `` /* 190-byte string literal not displayed */
	AnomalyPreprocessor    string  `` /* 172-byte string literal not displayed */
	AlertEnabled           bool    `yaml:"alert_enabled"              json:"alert_enabled"              honey:"label=Alert on anomalies"`
	AlertSuppressDuration  string  `` /* 141-byte string literal not displayed */
}

Logs holds per-command defaults for honey logs.

type MeshConfig added in v0.3.7

type MeshConfig struct {
	Enabled    bool     `yaml:"enabled" json:"enabled" honey:"label=Enable mesh"`
	PrivateKey string   `` /* 143-byte string literal not displayed */
	RelayAddrs []string `` /* 138-byte string literal not displayed */
	ListenMesh bool     `yaml:"listen_mesh,omitempty" json:"listen_mesh,omitempty" honey:"label=Also act as a relay (only if reachable)"`
	// ForceReachability overrides libp2p's AutoNAT reachability detection.
	// Empty = automatic (default). "private" forces this node to consider
	// itself behind NAT so AutoRelay always obtains a relay reservation — set
	// this on a mesh server whose relay sits on the same LAN (or any network
	// where AutoNAT wrongly concludes the node is publicly reachable and so
	// skips reserving, causing clients to get NO_RESERVATION). "public" forces
	// the opposite. Rarely needed; leave empty unless diagnosing reservations.
	ForceReachability string `` /* 163-byte string literal not displayed */
}

MeshConfig configures this process's own libp2p mesh identity, used to reach (and be reached by) honey backends flagged mesh: true — see HoneyBackend.Mesh. RelayAddrs are multiaddrs of self-hosted, generic libp2p relay node(s) (not honey-specific infrastructure) used for NAT traversal via Circuit Relay v2 + DCUtR.

type Plugins added in v0.2.9

type Plugins struct {
	Enabled           *bool    `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	Directory         string   `yaml:"directory,omitempty" json:"directory,omitempty" mod:"trim"`
	Allowlist         []string `yaml:"allowlist,omitempty" json:"allowlist,omitempty"`
	MaxMemoryMB       int      `yaml:"max_memory_mb,omitempty" json:"max_memory_mb,omitempty"`
	TimeoutMS         int      `yaml:"timeout_ms,omitempty" json:"timeout_ms,omitempty"`
	NetworkDeny       *bool    `yaml:"network_deny,omitempty" json:"network_deny,omitempty"`
	NetworkAllowHosts []string `yaml:"network_allow_hosts,omitempty" json:"network_allow_hosts,omitempty"`
	AllowHostNetwork  bool     `yaml:"allow_host_network,omitempty" json:"allow_host_network,omitempty"`
}

Plugins configures WASM plugins loaded from disk (Extism).

func (Plugins) WithDefaults added in v0.2.9

func (p Plugins) WithDefaults() PluginsEffective

WithDefaults returns effective plugin settings (plugins disabled unless explicitly enabled).

type PluginsEffective added in v0.2.9

type PluginsEffective struct {
	Enabled           bool
	Directory         string
	Allowlist         []string
	MaxMemoryMB       int
	TimeoutMS         int
	NetworkDeny       bool
	NetworkAllowHosts []string
	AllowHostNetwork  bool
}

PluginsEffective holds resolved plugin settings for runtime.

type ProxmoxBackend added in v0.2.3

type ProxmoxBackend struct {
	Name           string         `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	URL            string         `yaml:"url" json:"url" honey:"label=URL" validate:"required,url" mod:"trim"`
	User           string         `yaml:"user,omitempty" json:"user,omitempty" honey:"label=User" validate:"required_without=TokenID" mod:"trim"`
	Password       string         `` /* 132-byte string literal not displayed */
	TokenID        string         `yaml:"token_id,omitempty" json:"token_id,omitempty" honey:"label=Token ID" validate:"required_without=User" mod:"trim"`
	TokenSecret    string         `` /* 141-byte string literal not displayed */
	Insecure       bool           `yaml:"insecure" json:"insecure" honey:"label=Insecure TLS;default=false"`
	ExecMode       string         `yaml:"exec_mode,omitempty" json:"exec_mode,omitempty" honey:"label=Exec mode;enum=ssh|pve|hybrid;enum_as_warning" mod:"trim"`
	DockerDiscover DockerDiscover `yaml:"docker_discover,omitempty" json:"docker_discover,omitempty" honey:"label=Docker Auto-Discover"`
}

ProxmoxBackend configures one Proxmox VE listing.

type SMTPConfig added in v0.3.6

type SMTPConfig struct {
	Host     string `yaml:"host,omitempty" json:"host,omitempty"`
	Port     int    `yaml:"port,omitempty" json:"port,omitempty"`
	Username string `yaml:"username,omitempty" json:"username,omitempty"`
	Password string `yaml:"password,omitempty" json:"password,omitempty" honey:"secret"`
}

SMTPConfig holds global SMTP configuration for email notifications.

type SchemaField added in v0.2.8

type SchemaField struct {
	Key           string          `json:"key"`
	Label         string          `json:"label"`
	Type          SchemaFieldType `json:"type"`
	Format        string          `json:"format,omitempty"` // "ip", "url", etc.
	Required      bool            `json:"required,omitempty"`
	Secret        bool            `json:"secret,omitempty"`
	Enum          []string        `json:"enum,omitempty"`
	EnumAsWarning bool            `json:"enum_as_warning,omitempty"`
	Default       any             `json:"default,omitempty"`
	Items         []SchemaField   `json:"items,omitempty"` // For nested array of objects
}

SchemaField describes one editable key in defaults/backends schema.

type SchemaFieldType added in v0.2.8

type SchemaFieldType string

SchemaFieldType describes supported primitive config field kinds.

const (
	SchemaFieldTypeString  SchemaFieldType = "string"
	SchemaFieldTypeBoolean SchemaFieldType = "boolean"
	SchemaFieldTypeInteger SchemaFieldType = "integer"
	SchemaFieldTypeNumber  SchemaFieldType = "number"
	SchemaFieldTypeArray   SchemaFieldType = "array"
	SchemaFieldTypeObject  SchemaFieldType = "object"
)

Primitive field kinds for defaults/backends schema and JSON Schema "type".

type StudioConfig added in v0.3.5

type StudioConfig struct {
	RecipesPath string `yaml:"recipes_path,omitempty" json:"recipes_path,omitempty" honey:"label=Recipes directory" mod:"trim"`
	GitURL      string `yaml:"git_url,omitempty" json:"git_url,omitempty" honey:"label=Default Git URL" mod:"trim"`
	GitBranch   string `yaml:"git_branch,omitempty" json:"git_branch,omitempty" honey:"label=Default Git Branch" mod:"trim"`
	GitUser     string `yaml:"git_user,omitempty" json:"git_user,omitempty" honey:"label=Default Git User" mod:"trim"`
	GitPass     string `yaml:"git_pass,omitempty" json:"git_pass,omitempty" honey:"label=Default Git Pass;secret" mod:"trim"`
	GitSSH      string `yaml:"git_ssh,omitempty" json:"git_ssh,omitempty" honey:"label=Default Git SSH private key;secret" mod:"trim"`
}

StudioConfig holds settings for Recipe Studio UI integration.

type TransferConfig added in v0.2.8

type TransferConfig struct {
	PresignedMaxSize        string `yaml:"presigned_max_size,omitempty" json:"presigned_max_size,omitempty" mod:"trim"`
	MultipartThreshold      string `yaml:"multipart_threshold,omitempty" json:"multipart_threshold,omitempty" mod:"trim"`
	PresignedURLTTL         string `yaml:"presigned_url_ttl,omitempty" json:"presigned_url_ttl,omitempty" mod:"trim"`
	PresignedRetryWithAgent *bool  `yaml:"presigned_retry_with_agent,omitempty" json:"presigned_retry_with_agent,omitempty"`
	ForceAgentPath          bool   `yaml:"force_agent_path,omitempty" json:"force_agent_path,omitempty"`
}

TransferConfig controls the agent-transfer code path. Zero values mean "use defaults" — call WithDefaults() to materialize.

func (TransferConfig) WithDefaults added in v0.2.8

func (c TransferConfig) WithDefaults() TransferConfigEffective

WithDefaults returns an effective config, parsing strings to bytes / durations and substituting defaults for unset fields.

type TransferConfigEffective added in v0.2.8

type TransferConfigEffective struct {
	PresignedMaxSizeBytes   int64
	MultipartThresholdBytes int64
	PresignedURLTTL         time.Duration
	PresignedRetryWithAgent bool
	ForceAgentPath          bool
}

TransferConfigEffective is the post-defaults form used by callers.

type TrueNASBackend added in v0.3.0

type TrueNASBackend struct {
	Name             string `yaml:"name" json:"name" honey:"label=Name" validate:"required" mod:"trim"`
	URL              string `yaml:"url" json:"url" honey:"label=URL" validate:"required,url" mod:"trim"`
	Username         string `yaml:"username,omitempty" json:"username,omitempty" honey:"label=API key username (default root)" mod:"trim"`
	APIKey           string `yaml:"api_key" json:"api_key" honey:"label=API key;secret" validate:"required" mod:"trim"`
	Insecure         bool   `yaml:"insecure" json:"insecure" honey:"label=Insecure TLS;default=false"`
	IncludeAppliance *bool  `yaml:"include_appliance,omitempty" json:"include_appliance,omitempty" honey:"label=List appliance;default=true"`
	IncludeVMs       *bool  `yaml:"include_vms,omitempty" json:"include_vms,omitempty" honey:"label=List KVM VMs;default=true"`
	IncludeVirt      *bool  `yaml:"include_virt,omitempty" json:"include_virt,omitempty" honey:"label=List virt instances;default=true"`
	SSHUser          string `yaml:"ssh_user,omitempty" json:"ssh_user,omitempty" honey:"label=SSH user for appliance" mod:"trim"`
}

TrueNASBackend configures one TrueNAS SCALE controller (WebSocket API 25.04+).

type UISchema added in v0.2.8

type UISchema struct {
	TopLevelKeys []string                 `json:"top_level_keys"`
	Defaults     []SchemaField            `json:"defaults"`
	Backends     map[string]BackendSchema `json:"backends"`
	BackendOrder []string                 `json:"backend_order"`
}

UISchema is the lightweight UI-focused schema payload.

func BuildUISchema added in v0.2.8

func BuildUISchema() UISchema

BuildUISchema returns the lightweight schema used by web UI rendering and linting.

type ValidationError added in v0.2.9

type ValidationError struct {
	Path    string `json:"path"`
	Message string `json:"message"`
}

ValidationError represents a single field validation error.

type ValidationErrors added in v0.2.9

type ValidationErrors []ValidationError

ValidationErrors is a slice of ValidationError that serializes to JSON.

func (ValidationErrors) Error added in v0.2.9

func (e ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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