1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-07-12 07:11:17 +02:00

Add "myip6" URL parameter to provide an IPv6 address in addition to an IPv4 one as "myip"

This commit is contained in:
cn
2016-12-07 14:16:57 +01:00
parent ae095c22b7
commit 4894015325
6 changed files with 71 additions and 22 deletions

View File

@ -18,11 +18,13 @@ module Dyndnsd
out << "@ IN SOA #{@dns} #{@email_addr} ( #{zone['serial']} 3h 5m 1w 1h )"
out << "@ IN NS #{@dns}"
out << ""
zone['hosts'].each do |hostname,ip|
ip = IPAddr.new(ip).native
type = ip.ipv6? ? "AAAA" : "A"
name = hostname.chomp('.' + @domain)
out << "#{name} IN #{type} #{ip}"
zone['hosts'].each do |hostname,ips|
(ips.is_a?(Array) ? 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