Documentation
¶
Overview ¶
Package aliasstore persists user-defined device nicknames in a JSON file, keyed by MAC address so a label survives DHCP address changes.
ponytail: a flat JSON map is right for a handful of hand-set nicknames: zero dependencies, human-editable, loaded once. Ceilings, none of which bite at this scale: the whole file is rewritten on every Set/Delete, and there is no cross-process lock. Move to an embedded KV or SQLite only if this ever grows to thousands of entries or concurrent writers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns the per-user location of the alias file (<user-config-dir>/netwp/aliases.json), creating the netwp directory.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a MAC-to-nickname map backed by a JSON file. Safe for concurrent use within one process.
func Open ¶
Open loads the store at path. A missing file yields an empty store; the file is created on the first Set.
func (*Store) Alias ¶
func (s *Store) Alias(mac net.HardwareAddr) string
Alias implements core.AliasLookup.
func (*Store) Delete ¶
func (s *Store) Delete(mac net.HardwareAddr) error
Delete removes any nickname for mac and persists the change.