make negative TTL default to same value as TTL

This commit is contained in:
Alvaro Saurin committed 2015-06-17 10:17:12 +02:00
1 parent 8a935e3cb2
commit d086867c0c
4 files changed
+14 -15

No files matched your search

+3 -2
View File
@@ -45,7 +45,7 @@ type DNSServerConfig struct {
Cache ZoneCache
// (Optional) TTL for local domain responses
LocalTTL int
// (Optional) TTL for negative results in the local domain
// (Optional) TTL for negative results in the local domain (defaults to LocalTTL)
CacheNegLocalTTL int
// (Optional) for a specific clock provider
Clock clock.Clock
@@ -120,7 +120,6 @@ func NewDNSServer(config DNSServerConfig) (s *DNSServer, err error) {
cacheDisabled: false,
maxAnswers: DefaultMaxAnswers,
localTTL: DefaultLocalTTL,
negLocalTTL: DefaultCacheNegLocalTTL,
clock: config.Clock,
}
@@ -164,6 +163,8 @@ func NewDNSServer(config DNSServerConfig) (s *DNSServer, err error) {
}
if config.CacheNegLocalTTL > 0 {
s.negLocalTTL = config.CacheNegLocalTTL
} else {
s.negLocalTTL = s.localTTL
}
if config.CacheDisabled {
s.cacheDisabled = true