SOA RR update: minttl and a few syntax changes.
This commit is contained in:
parent
ae631aa2a8
commit
809b34c571
2
Makefile
2
Makefile
@ -20,6 +20,8 @@ Q ?= @
|
||||
DOMAIN ?= example.com
|
||||
zone-file:
|
||||
crystal run ./tools/write-zone-file.cr -- $(DOMAIN)
|
||||
zone-basic-template-file:
|
||||
crystal run ./tools/write-template-zone-file.cr -- $(DOMAIN)
|
||||
|
||||
VERBOSITY ?= 4
|
||||
run-client-verbosity:
|
||||
|
@ -42,7 +42,7 @@ class DNSManager::Storage::Zone
|
||||
|
||||
# zone class is omited, it always will be IN in our case.
|
||||
def initialize(@name, @ttl, @target)
|
||||
@rrtype = self.class.name.downcase.gsub /dnsmanager::storage::zone::/, ""
|
||||
@rrtype = self.class.name.upcase.gsub /DNSMANAGER::STORAGE::ZONE::/, ""
|
||||
end
|
||||
|
||||
def get_errors : Array(Error)
|
||||
@ -50,7 +50,7 @@ class DNSManager::Storage::Zone
|
||||
end
|
||||
|
||||
def to_s(io : IO)
|
||||
io << "(#{ "%4d" % @rrid }) #{ "%30s" % @name} #{ "%6d" % @ttl} IN #{ "%10s" % @rrtype.upcase} #{ "%30s" % @target}\n"
|
||||
io << "(#{ "%4d" % @rrid }) #{ "%30s" % @name} #{ "%6d" % @ttl} IN #{ "%10s" % @rrtype } #{ "%30s" % @target}\n"
|
||||
end
|
||||
end
|
||||
|
||||
@ -62,19 +62,25 @@ class DNSManager::Storage::Zone
|
||||
property refresh : UInt64 = 86400 # #seconds before requesting new zone version (master-slave).
|
||||
property retry : UInt64 = 7200 # #seconds before retry accessing new data from the master.
|
||||
property expire : UInt64 = 3600000 # #seconds slaves should consider master dead.
|
||||
property minttl : UInt64 = 600 # #seconds slaves should consider master dead.
|
||||
|
||||
def initialize(@name, @ttl, @target,
|
||||
@mname, @rname,
|
||||
@serial = 0.to_u64, @refresh = 86400.to_u64, @retry = 7200.to_u64, @expire = 3600000.to_u64)
|
||||
@rrtype = "soa"
|
||||
def initialize(@name, @ttl, @mname, @rname,
|
||||
@serial = 0.to_u64,
|
||||
@refresh = 86400.to_u64,
|
||||
@retry = 7200.to_u64,
|
||||
@expire = 3600000.to_u64,
|
||||
@minttl = 600.to_u64)
|
||||
@target = "" # no use
|
||||
@rrtype = "SOA"
|
||||
end
|
||||
|
||||
def to_s(io : IO)
|
||||
io << "(#{ "%4d" % @rrid }) #{name} #{ttl} #{target} #{@rrtype.upcase} (#{mname} #{rname}\n"
|
||||
io << "(#{ "%4d" % @rrid }) #{name} #{ttl} IN SOA (#{mname} #{rname}\n"
|
||||
io << "\t\t#{ "%10d" % serial } ; serial\n"
|
||||
io << "\t\t#{ "%10d" % refresh } ; refresh\n"
|
||||
io << "\t\t#{ "%10d" % retry } ; retry\n"
|
||||
io << "\t\t#{ "%10d" % expire } ; expire\n"
|
||||
io << "\t\t#{ "%10d" % minttl } ; minttl\n"
|
||||
io << "\t)\n"
|
||||
end
|
||||
|
||||
@ -221,7 +227,7 @@ class DNSManager::Storage::Zone
|
||||
class MX < ResourceRecord
|
||||
property priority : UInt32 = 10
|
||||
def initialize(@name, @ttl, @target, @priority = 10)
|
||||
@rrtype = "mx"
|
||||
@rrtype = "MX"
|
||||
end
|
||||
|
||||
def to_s(io : IO)
|
||||
@ -256,7 +262,7 @@ class DNSManager::Storage::Zone
|
||||
property priority : UInt32 = 10
|
||||
property weight : UInt32 = 10
|
||||
def initialize(@name, @ttl, @target, @port, @protocol = "tcp", @priority = 10, @weight = 10)
|
||||
@rrtype = "srv"
|
||||
@rrtype = "SRV"
|
||||
end
|
||||
|
||||
def get_errors : Array(Error)
|
||||
|
@ -21,19 +21,18 @@ zone = DSZ.new domain
|
||||
|
||||
zone << DSZ::SOA.new "#{domain}.", # name
|
||||
60.to_u32, # TTL
|
||||
"IN", # target (??)
|
||||
"ns0.some-example.com.", # Master Name Server for the zone
|
||||
"john\.doe.#{domain}" # admin email address
|
||||
|
||||
zone << DSZ::NS.new "#{domain}.", 3600.to_u32, "ns1.some-example.com."
|
||||
zone << DSZ::NS.new "#{domain}.", 3600.to_u32, "ns0.some-example.com."
|
||||
|
||||
zone << DSZ::A.new "www", 600.to_u32, "10.0.0.1"
|
||||
zone << DSZ::A.new "www2", 600.to_u32, "10.0.0.2"
|
||||
zone << DSZ::A.new "mail", 300.to_u32, "10.0.0.10"
|
||||
|
||||
zone << DSZ::CNAME.new "mail2", 600.to_u32, "www"
|
||||
|
||||
zone << DSZ::NS.new "#{domain}.", 3600.to_u32, "ns1.some-example.com."
|
||||
zone << DSZ::NS.new "#{domain}.", 3600.to_u32, "ns0.some-example.com."
|
||||
|
||||
zone << DSZ::MX.new "mail", 300.to_u32, "mail", 10
|
||||
zone << DSZ::MX.new "mail", 300.to_u32, "mail2", 5
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user