logargs

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: BSD-2-Clause Imports: 4 Imported by: 0

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

View Source
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

func EndpointName(value string) string

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

func EnsureQueryIdentity(args map[string]any)

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

func NS(name string, address string) map[string]any

NS returns canonical singular endpoint fields.

Output keys: - "ns": normalized nameserver name (if non-empty) - "address": endpoint IP address (if non-empty)

func NormalizeQueryIdentity

func NormalizeQueryIdentity(args map[string]any)

NormalizeQueryIdentity ensures canonical query keys and drops legacy query aliases used during migration.

func QueryIdentity

func QueryIdentity(name string, qtype string, qclass string) map[string]any

QueryIdentity returns canonical query identity fields.

Output keys: - "query_name" - "query_type" - "query_class"

func Servers

func Servers(items []Server) map[string]any

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

func ServersFromValues(values []string) map[string]any

ServersFromValues converts mixed endpoint identity values to canonical servers data.

Each input value may be: - "<name>/<ip>" - "<name>" - "<ip>"

func SetNS

func SetNS(args map[string]any, name string, address string)

SetNS writes canonical singular endpoint fields into args.

func SetQueryIdentity

func SetQueryIdentity(args map[string]any, name string, qtype string, qclass string)

SetQueryIdentity writes canonical query identity fields into args.

func UniqueSortedEndpointNames

func UniqueSortedEndpointNames(values []string) []string

UniqueSortedEndpointNames normalizes mixed endpoint identity strings to nameserver names when possible, then deduplicates and sorts.

Types

type NameserverLike

type NameserverLike interface {
	NameString() string
	AddressString() string
}

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.

type Server

type Server struct {
	// NS is the normalized nameserver host name.
	NS string
	// Address is the endpoint IP address.
	Address string
}

Server represents a nameserver endpoint using canonical key names.

Jump to

Keyboard shortcuts

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