Documentation
¶
Overview ¶
Package stats provides an in-memory, bounded aggregation of DNS activity over a rolling 24h window. It has no dependency on resolvers or HTTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector aggregates samples into hourly buckets with a 24h sliding window.
func NewCollector ¶
func NewCollector() *Collector
NewCollector returns a Collector using the wall clock.
func (*Collector) SetAllowlistCount ¶
SetAllowlistCount records the current entry count for an allowlist group.
func (*Collector) SetCacheEntries ¶
SetCacheEntries records the current result-cache size (point-in-time).
func (*Collector) SetDenylistCount ¶
SetDenylistCount records the current entry count for a denylist group.
type Disposition ¶
type Disposition int
Disposition is the final outcome class of a query.
const ( DispositionAnswered Disposition = iota DispositionDropped DispositionErrored )
type ListCounts ¶
ListCounts holds current per-group list entry counts (point-in-time).
type Result ¶
type Result struct {
Start time.Time
End time.Time
Summary Summary
ByResponseType map[string]int
ByQueryType map[string]int
ByResponseCode map[string]int
PerHour []HourPoint
TopDomains []NameCount
TopBlockedDomains []NameCount
TopClients []NameCount
Lists ListCounts
CacheEntries int
}
Result is the full snapshot returned to the API layer.
type Sample ¶
type Sample struct {
RType string
Disposition Disposition
QType string
RCode string
Domain string
Client string
DurationMs int64
}
Sample is a single recorded query — primitives only; never retains *dns.Msg. Whether the query was blocked is derived from RType (see isBlockedRType), so there is a single source of truth for the "blocked" classification.