Sha256: 3b979dd2662f30b456965830859142c8ad29a0c4148770d6e62a44f2b00b144f
Contents?: true
Size: 951 Bytes
Versions: 3
Compression:
Stored size: 951 Bytes
Contents
module Dyndnsd module Generator class Bind def initialize(domain, config) @domain = domain @ttl = config['ttl'] @dns = config['dns'] @email_addr = config['email_addr'] @additional_zone_content = config['additional_zone_content'] end def generate(db) out = [] out << "$TTL #{@ttl}" out << "$ORIGIN #{@domain}." out << '' out << "@ IN SOA #{@dns} #{@email_addr} ( #{db['serial']} 3h 5m 1w 1h )" out << "@ IN NS #{@dns}" out << '' db['hosts'].each do |hostname, ips| ips.each do |ip| ip = IPAddr.new(ip).native type = ip.ipv6? ? 'AAAA' : 'A' name = hostname.chomp('.' + @domain) out << "#{name} IN #{type} #{ip}" end end out << '' out << @additional_zone_content out << '' out.join("\n") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
dyndnsd-2.0.0 | lib/dyndnsd/generator/bind.rb |
dyndnsd-2.0.0.rc2 | lib/dyndnsd/generator/bind.rb |
dyndnsd-2.0.0.rc1 | lib/dyndnsd/generator/bind.rb |