Pull request #847: dnsfilter: add $dnstype handling

Merge in DNS/adguard-home from 2337-dnstype to master

Updates #2102.
Updates #2337.

Squashed commit of the following:

commit ac4b7522c732c0bf8ee06539fd4c95b5dc1c87b8
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Nov 24 17:50:33 2020 +0300

    dnsfilter: add $dnstype handling
This commit is contained in:
Ainar Garipov
2020-11-24 19:55:05 +03:00
parent 1cf9848044
commit e685d81c92
6 changed files with 81 additions and 72 deletions

View File

@@ -596,11 +596,13 @@ func (d *Dnsfilter) matchHost(host string, qtype uint16, setts RequestFilteringS
// but also while using the rules returned by it.
defer d.engineLock.RUnlock()
ureq := urlfilter.DNSRequest{}
ureq.Hostname = host
ureq.ClientIP = setts.ClientIP
ureq.ClientName = setts.ClientName
ureq.SortedClientTags = setts.ClientTags
ureq := urlfilter.DNSRequest{
Hostname: host,
SortedClientTags: setts.ClientTags,
ClientIP: setts.ClientIP,
ClientName: setts.ClientName,
DNSType: qtype,
}
if d.filteringEngineWhite != nil {
rr, ok := d.filteringEngineWhite.MatchRequest(ureq)