config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package config manages proximo's persisted user configuration and the on-disk paths it uses (TLS material, the embedded stack, etc.).

Index

Constants

View Source
const (
	// DefaultTLD is the default top-level domain used for local routing.
	// ".test" is reserved by RFC 6761 and never collides with mDNS (".local").
	DefaultTLD = "test"

	// DNSPort is the loopback UDP host port the DNS server is published on. A
	// high port avoids any privileged bind to :53; 5353 is intentionally
	// avoided because macOS mDNSResponder (Bonjour) already binds it.
	DNSPort = 5354
)

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns (creating if needed) the per-user configuration directory.

func NormalizeTLD

func NormalizeTLD(raw string) (string, error)

NormalizeTLD validates and normalizes a user-supplied TLD: it strips a leading dot, lowercases, enforces a single DNS label, and rejects reserved values.

func SubDir

func SubDir(name string) (string, error)

SubDir returns (creating if needed) a named subdirectory under Dir.

Types

type Config

type Config struct {
	// TLD is the top-level domain routed to the local proximo (without a dot).
	TLD string `json:"tld"`
}

Config holds the user-configurable settings persisted to disk.

func Default

func Default() Config

Default returns a Config populated with default values.

func Load

func Load() (Config, error)

Load reads the persisted config, returning defaults when none exists yet.

func (Config) Save

func (c Config) Save() error

Save persists the config to disk.

Jump to

Keyboard shortcuts

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