$ dig test.example.com
;test.example.com. IN A
;; ANSWER SECTION:
test.example.com. 300000 IN A 192.168.0.1
$ dig ns test.example.com
;; QUESTION SECTION:
;test.example.com. IN NS
;; ANSWER SECTION:
test.example.com. 300000 IN NS ns1.example.net.
test.example.com. 300000 IN NS ns2.example.net.
My expectation is
A Record TTL: 600
NS TTL:300000
so i changed the code:
// /geodns/zones/reader.go#setupZoneData
var defaultTtl uint32 = 86400
if zone.Labels[k].Ttl > 0 {
defaultTtl = uint32(zone.Labels[k].Ttl)
}
if r.RR.Header().Rrtype != dns.TypeNS {
// NS records have special treatment. If they are not specified, they default to 86400 rather than
// defaulting to the zone ttl option. The label TTL option always works though
defaultTtl = uint32(zone.Options.Ttl)
}
if r.RR.Header().Ttl == 0 {
r.RR.Header().Ttl = defaultTtl
}
//old code
var defaultTtl uint32 = 86400
if r.RR.Header().Rrtype != dns.TypeNS {
// NS records have special treatment. If they are not specified, they default to 86400 rather than
// defaulting to the zone ttl option. The label TTL option always works though
defaultTtl = uint32(zone.Options.Ttl)
}
if zone.Labels[k].Ttl > 0 {
defaultTtl = uint32(zone.Labels[k].Ttl)
}
if r.RR.Header().Ttl == 0 {
r.RR.Header().Ttl = defaultTtl
}
dig result:
$ dig test.example.com
;; QUESTION SECTION:
;test.example.com. IN A
;; ANSWER SECTION:
test.example.com. 600 IN A 192.168.0.1
$ dig ns test.example.com
;; QUESTION SECTION:
;test.example.com. IN NS
;; ANSWER SECTION:
test.example.com. 300000 IN NS ns1.example.net.
test.example.com. 300000 IN NS ns2.example.net.
I try to set NS ttl like this: test.example.com.json
but A record ttl:
My expectation is
so i changed the code:
dig result: