Documentation
¶
Overview ¶
Package views serves per-client static answers for configured zones. A query whose source IP falls inside one of a view's CIDRs gets that view's records as the response; queries that don't match any view (by source IP or by name) fall through the chain to the regular resolution path.
Views are intentionally evaluated before blocklist and resolver so an admin-curated answer for a specific client always wins. Internal sub-queries skip views entirely — they have no meaningful client IP and views are a client-traffic concept.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Views ¶
type Views struct {
// contains filtered or unexported fields
}
Views is the configured set of per-CIDR static-answer views, evaluated in the order they appeared in cfg.Views.
func New ¶
New parses cfg.Views into compiled in-memory tables. Malformed networks and unparseable RR strings are logged and skipped, matching the lenient pattern accesslist / blocklist already use — a typo in one entry should not knock out the rest of the config.
func (*Views) ClientOnly ¶
(*Views).ClientOnly excludes views from internal sub-pipelines. Views answer based on the originating client's IP; an internal sub-query has no real client and would otherwise fall through to whatever sentinel address the internal writer carries.
func (*Views) ServeDNS ¶
func (v *Views) ServeDNS(ctx context.Context, ch *middleware.Chain)
(*Views).ServeDNS dispatches a query to the first view whose source CIDR contains the client IP. If a record matches the query's name and type, the synthesised reply is written and the chain is short-circuited; otherwise the request falls through.