From 57c510631e44d8a36a7fb086b23143b36110a956 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 15 Jul 2019 12:10:43 +0300 Subject: [PATCH] - dnsfilter: fix crash when global setting 'SafeSearch' is off but per-client setting is on --- dnsfilter/dnsfilter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dnsfilter/dnsfilter.go b/dnsfilter/dnsfilter.go index 738ee039..3716139c 100644 --- a/dnsfilter/dnsfilter.go +++ b/dnsfilter/dnsfilter.go @@ -731,13 +731,13 @@ func New(c *Config, filters map[int]string) *Dnsfilter { if c != nil { // initialize objects only once - if c.SafeBrowsingEnabled && gctx.safebrowsingCache == nil { + if gctx.safebrowsingCache == nil { gctx.safebrowsingCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } - if c.SafeSearchEnabled && gctx.safeSearchCache == nil { + if gctx.safeSearchCache == nil { gctx.safeSearchCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } - if c.ParentalEnabled && gctx.parentalCache == nil { + if gctx.parentalCache == nil { gctx.parentalCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } if len(c.ResolverAddress) != 0 && gctx.dialCache == nil {