Documentation
¶
Index ¶
Constants ¶
const ( ModeReadWrite = "readwrite" ModeReadOnly = "read" ModeWriteOnly = "write" )
Reader mode identifiers as they appear on the wire and on disk. nfc's ReaderMode is an iota, so persisting it directly would reinterpret stored files if a mode were ever inserted.
Variables ¶
This section is empty.
Functions ¶
func FormatMode ¶
func FormatMode(mode nfc.ReaderMode) string
FormatMode converts a nfc.ReaderMode to its stored identifier.
func ParseMode ¶
func ParseMode(mode string) nfc.ReaderMode
ParseMode converts a stored identifier to a nfc.ReaderMode, falling back to read/write so a file from a newer build cannot leave the reader unusable.
Types ¶
type Settings ¶
type Settings struct {
// Mode is the reader access mode: "readwrite", "read" or "write".
Mode string `json:"mode"`
// CardTypes is the card-type allowlist. Empty means every type is allowed,
// matching the agent's behaviour when no filter has ever been set.
CardTypes []string `json:"cardTypes"`
// DevicePath pins a specific reader. Empty means auto-detect.
DevicePath string `json:"devicePath"`
// Port is the agent server port. Zero means the built-in default.
//
// Applied at startup only: changing it needs the listener rebound, which
// the console does explicitly rather than as a side effect of saving.
Port int `json:"port"`
// RequirePairedDevice admits only devices holding a paired credential.
RequirePairedDevice bool `json:"requirePairedDevice"`
}
Settings holds the operator preferences that survive a restart.
Credentials are deliberately not here: the API secret, paired devices and origin allowlist keep their own files.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists Settings under the config directory.
func New ¶
New loads settings from configDir, falling back to the defaults. No file is written on load, so its absence keeps meaning "never configured". An empty configDir yields an in-memory store.