Documentation ¶
Overview ¶
Package mainmw contains the main middleware of AdGuard DNS. It processes filtering, debug DNS API, query logging, as well as statistics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Messages is the message constructor used to create blocked and other // messages for this middleware. Messages *dnsmsg.Constructor // Cloner is used to clone messages more efficiently by disposing of parts // of DNS responses for later reuse. // // TODO(a.garipov): Use. Cloner *dnsmsg.Cloner // BillStat is used to collect billing statistics. BillStat billstat.Recorder // ErrColl is the error collector that is used to collect critical and // non-critical errors. ErrColl errcoll.Interface // FilterStorage is the storage of all filters. FilterStorage filter.Storage // GeoIP is the GeoIP database used to detect geographic data about IP // addresses in requests and responses. GeoIP geoip.Interface // QueryLog is used to write the logs into. QueryLog querylog.Interface // RuleStat is used to collect statistics about matched filtering rules and // rule lists. RuleStat rulestat.Interface // ResearchLogs controls whether logging of additional info for research // purposes is enabled. These logs may be overly verbose and are only // required temporary, that's why it's controlled by a separate setting. // This setting will only be used when ResearchMetrics is also set to true. ResearchLogs bool // ResearchMetrics controls whether research metrics are enabled or not. // This is a set of metrics that we may need temporary, so its collection is // controlled by a separate setting. ResearchMetrics bool }
Config is the configuration structure for the main middleware. All fields must be non-nil.
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware is the main middleware of AdGuard DNS.
func New ¶
func New(c *Config) (mw *Middleware)
New returns a new main 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
TODO(a.garipov): Refactor and lower gocognit to 10 or below.
Click to show internal directories.
Click to hide internal directories.