Skip to content

Commit

Permalink
* dns: disable cache with "cache_size: 0" setting
Browse files Browse the repository at this point in the history
  • Loading branch information
szolin committed Jun 16, 2020
1 parent 5a93c1f commit 547a971
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dnsforward/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ func (s *Server) createProxyConfig() (proxy.Config, error) {
Ratelimit: int(s.conf.Ratelimit),
RatelimitWhitelist: s.conf.RatelimitWhitelist,
RefuseAny: s.conf.RefuseAny,
CacheEnabled: true,
CacheSizeBytes: int(s.conf.CacheSize),
CacheMinTTL: s.conf.CacheMinTTL,
CacheMaxTTL: s.conf.CacheMaxTTL,
UpstreamConfig: s.conf.UpstreamConfig,
Expand All @@ -148,6 +146,11 @@ func (s *Server) createProxyConfig() (proxy.Config, error) {
EnableEDNSClientSubnet: s.conf.EnableEDNSClientSubnet,
}

if s.conf.CacheSize != 0 {
proxyConfig.CacheEnabled = true
proxyConfig.CacheSizeBytes = int(s.conf.CacheSize)
}

proxyConfig.UpstreamMode = proxy.UModeLoadBalance
if s.conf.AllServers {
proxyConfig.UpstreamMode = proxy.UModeParallel
Expand Down

0 comments on commit 547a971

Please sign in to comment.