diff --git a/dnsfilter/dnsfilter.go b/dnsfilter/dnsfilter.go index b1dcf04a..3ca639a3 100644 --- a/dnsfilter/dnsfilter.go +++ b/dnsfilter/dnsfilter.go @@ -25,6 +25,7 @@ import ( "golang.org/x/net/publicsuffix" ) +const defaultCacheSize = 64 * 1024 // in number of elements const defaultCacheTime = 30 * time.Minute const defaultHTTPTimeout = 5 * time.Minute @@ -67,10 +68,6 @@ type Config struct { SafeBrowsingEnabled bool `yaml:"safebrowsing_enabled"` ResolverAddress string // DNS server address - SafeBrowsingCacheSize int `yaml:"safebrowsing_cache_size"` - SafeSearchCacheSize int `yaml:"safesearch_cache_size"` - ParentalCacheSize int `yaml:"parental_cache_size"` - Rewrites []RewriteEntry `yaml:"rewrites"` // Filtering callback function @@ -857,13 +854,13 @@ func New(c *Config, filters map[int]string) *Dnsfilter { if c != nil { // initialize objects only once if gctx.safebrowsingCache == nil { - gctx.safebrowsingCache = gcache.New(c.SafeBrowsingCacheSize).LRU().Expiration(defaultCacheTime).Build() + gctx.safebrowsingCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } if gctx.safeSearchCache == nil { - gctx.safeSearchCache = gcache.New(c.SafeSearchCacheSize).LRU().Expiration(defaultCacheTime).Build() + gctx.safeSearchCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } if gctx.parentalCache == nil { - gctx.parentalCache = gcache.New(c.ParentalCacheSize).LRU().Expiration(defaultCacheTime).Build() + gctx.parentalCache = gcache.New(defaultCacheSize).LRU().Expiration(defaultCacheTime).Build() } if len(c.ResolverAddress) != 0 && gctx.dialCache == nil { gctx.dialCache = gcache.New(maxDialCacheSize).LRU().Expiration(defaultCacheTime).Build() diff --git a/home/config.go b/home/config.go index 85d8498a..fd3460ea 100644 --- a/home/config.go +++ b/home/config.go @@ -211,10 +211,6 @@ func initConfig() { // also change the default config config.DNS.UpstreamDNS = defaultDNS } - - config.DNS.SafeBrowsingCacheSize = 64 * 1024 - config.DNS.SafeSearchCacheSize = 64 * 1024 - config.DNS.ParentalCacheSize = 64 * 1024 } // getConfigFilename returns path to the current config file