* dnsfilter: use golibs/cache

+ config: add cache size settings
+ config: add cache_time setting
This commit is contained in:
Simon Zolin
2019-08-22 15:09:43 +03:00
parent 7d3fe71597
commit c616259e8b
5 changed files with 85 additions and 38 deletions

View File

@@ -100,6 +100,7 @@ type FilteringConfig struct {
// Per-client settings can override this configuration.
BlockedServices []string `yaml:"blocked_services"`
CacheSize uint `yaml:"cache_size"` // DNS cache size (in bytes)
dnsfilter.Config `yaml:",inline"`
}
@@ -203,6 +204,7 @@ func (s *Server) startInternal(config *ServerConfig) error {
RatelimitWhitelist: s.conf.RatelimitWhitelist,
RefuseAny: s.conf.RefuseAny,
CacheEnabled: true,
CacheSizeBytes: int(s.conf.CacheSize),
Upstreams: s.conf.Upstreams,
DomainsReservedUpstreams: s.conf.DomainsReservedUpstreams,
BeforeRequestHandler: s.beforeRequestHandler,