Documentation ¶
Overview ¶
Package initial contains the initial, outermost (except for ratelimit and access) middleware of the AdGuard DNS server. It handles Firefox canary hosts requests, applies profile access restrictions, sets and resets the AD bit for further processing, as well as puts as much information as it can into the context and request info.
Index ¶
Constants ¶
const ( // ResolverARPADomain is the non-FQDN version of the DNS Resolver // Special-Use domain pointing to itself. // // See https://www.ietf.org/archive/id/draft-ietf-add-ddr-07.html#section-8. ResolverARPADomain = "resolver.arpa" // DDRLabel is the leading label of the special domain name for DDR. DDRLabel = "_dns" // DDRDomain is the non-FQDN version of the Discovery of Designated // Resolvers for querying the resolver with unknown or absent name. DDRDomain = DDRLabel + "." + ResolverARPADomain // FirefoxCanaryHost is the hostname that Firefox uses to check if it // should use its own DNS-over-HTTPS settings. // // See https://support.mozilla.org/en-US/kb/configuring-networks-disable-dns-over-https. FirefoxCanaryHost = "use-application-dns.net" )
const ( ApplePrivateRelayMaskHost = "mask.icloud.com" ApplePrivateRelayMaskH2Host = "mask-h2.icloud.com" ApplePrivateRelayMaskCanaryHost = "mask-canary.icloud.com" )
Hostnames that Apple devices use to check if Apple Private Relay can be enabled. Returning NXDOMAIN to queries for these domain names blocks Apple Private Relay.
See https://developer.apple.com/support/prepare-your-network-for-icloud-private-relay.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Messages is used to build the responses specific for a request's context. Messages *dnsmsg.Constructor // FilteringGroup is the filtering group to which Server belongs. FilteringGroup *agd.FilteringGroup // ServerGroup is the server group to which Server belongs. ServerGroup *agd.ServerGroup // Server is the current server which serves the request. Server *agd.Server // DB is the database of user profiles and devices. ProfileDB profiledb.Interface // GeoIP detects the location of the request source. GeoIP geoip.Interface // ErrColl collects and reports the errors considered non-critical. ErrColl errcoll.Interface // ProfileDBEnabled is true, if user devices and profiles recognition is // enabled. ProfileDBEnabled bool }
Config is the configuration structure for the initial middleware. All fields must be non-nil.
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is the initial middleware of the AdGuard DNS server. This middleware must be the most outer middleware apart from the ratelimit and global access middlewares.
func New ¶
func New(c *Config) (mw *Middleware)
New returns a new initial middleware. c must not be nil.
func (*Middleware) Wrap ¶
func (mw *Middleware) Wrap(next dnsserver.Handler) (wrapped dnsserver.Handler)
Wrap implements the dnsserver.Middleware interface for *Middleware