Documentation
¶
Overview ¶
Package profile models, loads, and merges engine profile settings.
Index ¶
- Constants
- func AllProperties() []string
- func IsAllowedTarget(ctx context.Context, addr netip.Addr) bool
- func RenamedTag(tag string) (string, bool)
- func ResetEffective()
- func SetEffective(p *Profile)
- func WithAllowedTargets(ctx context.Context, addrs map[netip.Addr]struct{}) context.Context
- func WithContext(ctx context.Context, p *Profile) context.Context
- type ASNDBSettings
- type BadkeysSettings
- type DNSSEC04Vars
- type DiffKey
- type DiffModule
- type DiffProperty
- type DiffResult
- type DiffSummary
- type LogFilterRule
- type NetSettings
- type Profile
- type ResolverDefaults
- type ResolverSettings
- type TestCasesVars
- type TestLevelChange
- type TestLevelEntry
- type TestLevelsDiff
- type Zone02Vars
- type Zone04Vars
- type Zone05Vars
- type Zone06Vars
- type Zone13Vars
Constants ¶
const ( DiffKindChanged = "changed" // scalar or opaque property differing from the default DiffKindRedundant = "redundant" // scalar or opaque property restating the default DiffKindSet = "set" // order-insensitive set property (test_cases) DiffKindMap = "map" // keyed map property (test_levels, test_cases_vars) )
Diff entry kinds.
Variables ¶
This section is empty.
Functions ¶
func AllProperties ¶
func AllProperties() []string
AllProperties returns the list of recognized property names.
func IsAllowedTarget ¶ added in v1.5.5
IsAllowedTarget reports whether addr was explicitly supplied by the operator.
func RenamedTag ¶ added in v1.7.0
RenamedTag reports the current name of a retired message tag identifier.
func ResetEffective ¶
func ResetEffective()
ResetEffective resets the effective profile to defaults.
func SetEffective ¶ added in v0.9.14
func SetEffective(p *Profile)
SetEffective overrides the global effective profile. Passing nil resets to defaults.
func WithAllowedTargets ¶ added in v1.5.5
WithAllowedTargets stores operator-supplied addresses that are exempt from the non-global query guard in ctx. Keys are stored unmapped.
Types ¶
type ASNDBSettings ¶
type ASNDBSettings struct {
// Style selects the ASN backend implementation.
Style string `json:"style"`
// Sources lists lookup endpoints per backend style.
Sources map[string][]string `json:"sources"`
}
ASNDBSettings holds ASN lookup defaults.
type BadkeysSettings ¶ added in v1.1.0
type BadkeysSettings struct {
// Path points to the badkeys data directory or file set.
Path string `json:"path"`
}
BadkeysSettings holds badkeys blocklist configuration.
type DNSSEC04Vars ¶
type DNSSEC04Vars struct {
// RemainingShort is the minimum acceptable remaining RRSIG lifetime.
RemainingShort int `json:"REMAINING_SHORT"`
// RemainingLong is the threshold for long remaining RRSIG lifetime.
RemainingLong int `json:"REMAINING_LONG"`
// DurationLong is the threshold for long total RRSIG validity.
DurationLong int `json:"DURATION_LONG"`
}
DNSSEC04Vars holds profile tunables for DNSSEC04 checks.
type DiffKey ¶ added in v1.7.0
type DiffKey struct {
Key string `json:"key"`
Default any `json:"default"`
Value any `json:"value"`
}
DiffKey is one key whose value differs between override and default.
type DiffModule ¶ added in v1.7.0
type DiffModule struct {
Module string `json:"module"`
Changed []DiffKey `json:"changed,omitempty"`
Missing []string `json:"missing,omitempty"`
Unknown []string `json:"unknown,omitempty"`
}
DiffModule collects the per-key findings for one module of a map property.
type DiffProperty ¶ added in v1.7.0
type DiffProperty struct {
Path string `json:"path"`
Kind string `json:"kind"`
Redundant bool `json:"redundant"`
Wholesale bool `json:"wholesale,omitempty"`
Default any `json:"default,omitempty"`
Value any `json:"value,omitempty"`
Excluded []string `json:"excluded,omitempty"`
Unknown []string `json:"unknown,omitempty"`
Modules []DiffModule `json:"modules,omitempty"`
}
DiffProperty is one property the override sets, compared against the default. Default and Value carry the compared values for kind "changed" only.
type DiffResult ¶ added in v1.7.0
type DiffResult struct {
Summary DiffSummary `json:"summary"`
Properties []DiffProperty `json:"properties"`
}
DiffResult is the comparison of an override profile against a base profile.
func Diff ¶ added in v1.7.0
func Diff(override, base *Profile) *DiffResult
Diff compares an override profile against a base profile, considering only the properties the override actually sets. An unset property is inherited and never a deviation.
A property reported redundant restates the base value exactly, so removing it from the override leaves the merged profile unchanged.
type DiffSummary ¶ added in v1.7.0
type DiffSummary struct {
Deviations int `json:"deviations"`
Redundant int `json:"redundant"`
Missing int `json:"missing"`
Unknown int `json:"unknown"`
}
DiffSummary counts the diff at a glance.
type LogFilterRule ¶
type LogFilterRule struct {
// When describes the match condition for the rule.
When map[string]any `json:"when"`
// Set names the filter action to apply when the rule matches.
Set string `json:"set"`
}
LogFilterRule mirrors the logfilter rule structure.
type NetSettings ¶
type NetSettings struct {
// IPv4 enables IPv4 transport when true.
IPv4 bool `json:"ipv4"`
// IPv6 enables IPv6 transport when true.
IPv6 bool `json:"ipv6"`
// AllowNonGlobalTargets permits querying non-globally-reachable addresses.
AllowNonGlobalTargets bool `json:"allow_non_global_targets"`
}
NetSettings holds IP stack enablement flags.
type Profile ¶
type Profile struct {
// Resolver contains resolver-specific profile settings.
Resolver ResolverSettings `json:"resolver"`
// Net controls IPv4 and IPv6 enablement.
Net NetSettings `json:"net"`
// NoNetwork blocks network access during a run when true.
NoNetwork bool `json:"no_network"`
// Cache stores cache-related profile settings keyed by cache area.
Cache map[string]map[string]any `json:"cache"`
// ASNDB configures ASN lookup behavior and upstream sources.
ASNDB ASNDBSettings `json:"asn_db"`
// Badkeys configures badkeys blocklist loading.
Badkeys BadkeysSettings `json:"badkeys"`
// LogFilter defines per-module/tag log filtering rules.
LogFilter map[string]map[string][]LogFilterRule `json:"logfilter"`
// TestLevels overrides log levels per module and tag.
TestLevels map[string]map[string]string `json:"test_levels"`
// TestCases limits the enabled testcase set when non-empty.
TestCases []any `json:"test_cases"`
// TestCasesVars holds testcase-specific numeric tunables.
TestCasesVars TestCasesVars `json:"test_cases_vars"`
// contains filtered or unexported fields
}
Profile holds the engine profile configuration and tracks which properties are set.
func FromContext ¶ added in v0.9.14
FromContext returns the profile stored in ctx, or the global effective profile.
func FromYAML ¶
FromYAML creates a profile from a YAML string. This implementation supports JSON-compatible YAML input.
func MustFromContext ¶ added in v0.9.14
MustFromContext returns the profile stored in ctx or panics.
type ResolverDefaults ¶
type ResolverDefaults struct {
// Fallback enables UDP-to-TCP fallback on truncation.
Fallback bool `json:"fallback"`
// Retrans sets the retransmission interval in seconds.
Retrans int `json:"retrans"`
// Retry sets the number of retry attempts.
Retry int `json:"retry"`
// Parallel sets the number of parallel resolver workers.
Parallel int `json:"parallel"`
// Unordered allows unordered resolver result handling.
Unordered bool `json:"unordered"`
// Timeout sets the per-query timeout in seconds.
Timeout int `json:"timeout"`
// ErrorCacheTTL sets the duration (seconds) to skip queries after network errors.
ErrorCacheTTL int `json:"error_cache_ttl"`
// PositiveCacheTTL sets the duration (seconds) to cache positive responses.
PositiveCacheTTL int `json:"positive_cache_ttl"`
// NegativeCacheTTL sets the duration (seconds) to cache negative responses.
NegativeCacheTTL int `json:"negative_cache_ttl"`
// FastFailTimeoutCount sets how many consecutive timeout-pattern failures
// cause a nameserver to be skipped for the remainder of the job. 0 disables.
FastFailTimeoutCount int `json:"fast_fail_timeout_count"`
// NameserverConcurrency limits concurrent queries per nameserver address. 0 disables.
NameserverConcurrency int `json:"nameserver_concurrency"`
// NameserverMaxTotalMS caps cumulative milliseconds spent per nameserver
// address per run; the address is skipped once exceeded. 0 disables.
NameserverMaxTotalMS int `json:"nameserver_max_total_ms"`
}
ResolverDefaults mirrors resolver defaults from the profile.
type ResolverSettings ¶
type ResolverSettings struct {
// Defaults contains default resolver behavior for queries.
Defaults ResolverDefaults `json:"defaults"`
// Source4 selects the IPv4 source address for outbound queries.
Source4 string `json:"source4"`
// Source6 selects the IPv6 source address for outbound queries.
Source6 string `json:"source6"`
}
ResolverSettings holds resolver-specific profile settings.
type TestCasesVars ¶
type TestCasesVars struct {
// DNSSEC04 holds tunables for DNSSEC04.
DNSSEC04 DNSSEC04Vars `json:"dnssec04"`
// Zone02 holds tunables for Zone02.
Zone02 Zone02Vars `json:"zone02"`
// Zone04 holds tunables for Zone04.
Zone04 Zone04Vars `json:"zone04"`
// Zone05 holds tunables for Zone05.
Zone05 Zone05Vars `json:"zone05"`
// Zone06 holds tunables for Zone06.
Zone06 Zone06Vars `json:"zone06"`
// Zone13 holds tunables for Zone13.
Zone13 Zone13Vars `json:"zone13"`
}
TestCasesVars stores per-testcase tunables.
type TestLevelChange ¶ added in v1.7.11
type TestLevelChange struct {
Module string `json:"module"`
Tag string `json:"tag"`
From string `json:"from"`
To string `json:"to"`
}
TestLevelChange is one tag the two profiles level differently.
type TestLevelEntry ¶ added in v1.7.11
type TestLevelEntry struct {
Module string `json:"module"`
Tag string `json:"tag"`
Level string `json:"level"`
}
TestLevelEntry is one tag of a profile's test_levels table.
type TestLevelsDiff ¶ added in v1.7.11
type TestLevelsDiff struct {
Added []TestLevelEntry `json:"added,omitempty"`
Removed []TestLevelEntry `json:"removed,omitempty"`
LevelChanged []TestLevelChange `json:"level_changed,omitempty"`
}
TestLevelsDiff is the tag vocabulary comparison of two profiles.
func DiffTestLevels ¶ added in v1.7.11
func DiffTestLevels(a, b *Profile) *TestLevelsDiff
DiffTestLevels compares the test_levels tables of two profiles as two tag vocabularies: a tag only in b is added, a tag only in a is removed, a tag in both at different levels is level-changed. Unlike Diff this is a symmetric comparison of two full profiles, not an override against a base, so it reads the table directly and never treats an unset property as inherited. Levels compare case-insensitively and are reported as stored. A nil profile is an empty vocabulary. Results are sorted by module, then tag.
func (*TestLevelsDiff) Empty ¶ added in v1.7.11
func (d *TestLevelsDiff) Empty() bool
Empty reports whether the two vocabularies agree.
type Zone02Vars ¶
type Zone02Vars struct {
// SOARefreshMinimumValue is the minimum acceptable SOA refresh value.
SOARefreshMinimumValue int `json:"SOA_REFRESH_MINIMUM_VALUE"`
}
Zone02Vars holds profile tunables for Zone02 checks.
type Zone04Vars ¶
type Zone04Vars struct {
// SOARetryMinimumValue is the minimum acceptable SOA retry value.
SOARetryMinimumValue int `json:"SOA_RETRY_MINIMUM_VALUE"`
}
Zone04Vars holds profile tunables for Zone04 checks.
type Zone05Vars ¶
type Zone05Vars struct {
// SOAExpireMinimumValue is the minimum acceptable SOA expire value.
SOAExpireMinimumValue int `json:"SOA_EXPIRE_MINIMUM_VALUE"`
}
Zone05Vars holds profile tunables for Zone05 checks.
type Zone06Vars ¶
type Zone06Vars struct {
// SOADefaultTTLMaximumValue is the maximum allowed SOA default TTL.
SOADefaultTTLMaximumValue int `json:"SOA_DEFAULT_TTL_MAXIMUM_VALUE"`
// SOADefaultTTLMinimumValue is the minimum allowed SOA default TTL.
SOADefaultTTLMinimumValue int `json:"SOA_DEFAULT_TTL_MINIMUM_VALUE"`
}
Zone06Vars holds profile tunables for Zone06 checks.
type Zone13Vars ¶ added in v1.1.2
type Zone13Vars struct {
// SPFLookupLimit is the maximum permitted SPF DNS lookup count.
SPFLookupLimit int `json:"SPF_LOOKUP_LIMIT"`
}
Zone13Vars holds profile tunables for Zone13 (SPF DNS lookup count) checks.