Documentation
¶
Overview ¶
Package logargs provides canonical key names and constructors for the structured arguments attached to engine log entries. Centralising them here keeps producers (testcases, transport) and consumers (i18n renderers, metrics) in sync as the canonical key set evolves.
Index ¶
- Constants
- func EndpointName(value string) string
- func EnsureQueryIdentity(args map[string]any)
- func NS(name string, address string) map[string]any
- func NormalizeQueryIdentity(args map[string]any)
- func QueryIdentity(name string, qtype string, qclass string) map[string]any
- func Servers(items []Server) map[string]any
- func ServersFromNameservers[T NameserverLike](items []T) map[string]any
- func ServersFromValues(values []string) map[string]any
- func SetNS(args map[string]any, name string, address string)
- func SetQueryIdentity(args map[string]any, name string, qtype string, qclass string)
- func UniqueSortedEndpointNames(values []string) []string
- type NameserverLike
- type Server
Constants ¶
const KeyAddress = "address"
KeyAddress is the canonical log-entry key for an endpoint IP address. It is exported so that both producers (engine) and consumers (metrics) stay in sync when the key name changes.
Variables ¶
This section is empty.
Functions ¶
func EndpointName ¶
EndpointName returns a canonical nameserver name when value is a mixed endpoint identity in "<name>/<ip>" form. Non-endpoint values are returned as-is.
func EnsureQueryIdentity ¶
EnsureQueryIdentity adds canonical query identity keys when legacy query keys are present. Legacy keys are left intact to keep template compatibility during migration.
func NS ¶
NS returns canonical singular endpoint fields.
Output keys: - "ns": normalized nameserver name (if non-empty) - "address": endpoint IP address (if non-empty)
func NormalizeQueryIdentity ¶
NormalizeQueryIdentity ensures canonical query keys and drops legacy query aliases used during migration.
func QueryIdentity ¶
QueryIdentity returns canonical query identity fields.
Output keys: - "query_name" - "query_type" - "query_class"
func Servers ¶
Servers builds canonical structured endpoint list data.
Output key: - "servers": []map[string]any{{"ns": "...", "address": "..."}, ...}
func ServersFromNameservers ¶
func ServersFromNameservers[T NameserverLike](items []T) map[string]any
ServersFromNameservers converts nameserver-like values to canonical servers data.
func ServersFromValues ¶ added in v1.1.1
ServersFromValues converts mixed endpoint identity values to canonical servers data.
Each input value may be: - "<name>/<ip>" - "<name>" - "<ip>"
func SetQueryIdentity ¶
SetQueryIdentity writes canonical query identity fields into args.
func UniqueSortedEndpointNames ¶
UniqueSortedEndpointNames normalizes mixed endpoint identity strings to nameserver names when possible, then deduplicates and sorts.
Types ¶
type NameserverLike ¶
NameserverLike is a minimal adapter for endpoint types used by ServersFromNameservers.
It is intentionally defined here to avoid importing engine/nameserver and creating package cycles when nameserver code starts consuming these helpers.