Merge: * DNS: use "unrestricted" Quad9 servers; - dnsfilter: fix hanging on error

Close #1451

Squashed commit of the following:

commit 91e5c98d7543b7c8872cc494818d66bb823ec7c0
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Mar 5 13:09:01 2020 +0300

    fix

commit 4f80865e55f27206fa9cef1d72fb3652498da582
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Mar 5 13:08:31 2020 +0300

    * fix race-detector issue

commit 5513c6c12c112c8f9325dbc8a8d09e58fe7611e0
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Mar 5 13:01:46 2020 +0300

    - dnsfilter: fix hanging on error

commit c7b81286833a523349efb8ca972eba3540518944
Author: Simon Zolin <s.zolin@adguard.com>
Date:   Thu Mar 5 12:42:19 2020 +0300

    * DNS: use "unrestricted" Quad9 servers
This commit is contained in:
Simon Zolin 2020-03-05 13:12:21 +03:00
parent f5658af484
commit 579177fc70
2 changed files with 5 additions and 3 deletions

View File

@ -228,6 +228,8 @@ func (d *Dnsfilter) filtersInitializer() {
// Close - close the object
func (d *Dnsfilter) Close() {
d.engineLock.Lock()
defer d.engineLock.Unlock()
d.reset()
}
@ -478,6 +480,7 @@ func createFilteringEngine(filters []Filter) (*filterlist.RuleStorage, *urlfilte
// Initialize urlfilter objects
func (d *Dnsfilter) initFiltering(allowFilters, blockFilters []Filter) error {
d.engineLock.Lock()
defer d.engineLock.Unlock()
d.reset()
rulesStorage, filteringEngine, err := createFilteringEngine(blockFilters)
if err != nil {
@ -491,7 +494,6 @@ func (d *Dnsfilter) initFiltering(allowFilters, blockFilters []Filter) error {
d.filteringEngine = filteringEngine
d.rulesStorageWhite = rulesStorageWhite
d.filteringEngineWhite = filteringEngineWhite
d.engineLock.Unlock()
log.Debug("initialized filtering engine")
return nil

View File

@ -32,9 +32,9 @@ const (
)
var defaultDNS = []string{
"https://dns.quad9.net/dns-query",
"https://dns10.quad9.net/dns-query",
}
var defaultBootstrap = []string{"9.9.9.9", "149.112.112.112"}
var defaultBootstrap = []string{"9.9.9.10", "149.112.112.10", "2620:fe::10", "2620:fe::fe:10"}
var webRegistered bool