Documentation
¶
Overview ¶
Package hostsfile implements a high-performance hosts file resolver with advanced features like wildcard support and automatic reloading
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostEntry ¶ added in v1.5.1
type HostEntry struct {
Name string
IPv4 []net.IP
IPv6 []net.IP
Aliases []string
Comment string
LineNo int
Timestamp time.Time
// contains filtered or unexported fields
}
HostEntry represents a single host with multiple IPs and metadata. The a/aaaa/cname fields hold pre-built RR slices so lookups can return them without allocating on the hot path.
type HostsDB ¶ added in v1.5.1
type HostsDB struct {
// contains filtered or unexported fields
}
HostsDB is an in-memory database for hosts entries Unlike traditional implementations, we support wildcards and aliases.
type Hostsfile ¶
type Hostsfile struct {
// contains filtered or unexported fields
}
Hostsfile middleware provides local name resolution.
func (*Hostsfile) ServeDNS ¶
func (h *Hostsfile) ServeDNS(ctx context.Context, ch *middleware.Chain)
(*Hostsfile).ServeDNS serveDNS handles DNS queries using the hosts database. A wire-born request is looked up by its wire question name — one string, no decode — and on the overwhelmingly common miss continues down the chain undecoded; a hit builds its response from parsed scalars, so this handler never materializes anything.