1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2024-12-22 00:54:22 +01:00

Merge pull request #2 from haasn/ipv6

Support IPv6 addresses
This commit is contained in:
Christian Nicolai 2015-06-18 14:11:37 +02:00
commit 567f252cad
2 changed files with 4 additions and 2 deletions

View File

@ -85,7 +85,7 @@ module Dyndnsd
# malformed myip? # malformed myip?
begin begin
IPAddr.new(params["myip"], Socket::AF_INET) IPAddr.new(params["myip"])
rescue ArgumentError rescue ArgumentError
params["myip"] = env["REMOTE_ADDR"] params["myip"] = env["REMOTE_ADDR"]
end end

View File

@ -19,8 +19,10 @@ module Dyndnsd
out << "@ IN NS #{@dns}" out << "@ IN NS #{@dns}"
out << "" out << ""
zone['hosts'].each do |hostname,ip| zone['hosts'].each do |hostname,ip|
ip = IPAddr.new(ip).native
type = ip.ipv6? ? "AAAA" : "A"
name = hostname.chomp('.' + @domain) name = hostname.chomp('.' + @domain)
out << "#{name} IN A #{ip}" out << "#{name} IN #{type} #{ip}"
end end
out << "" out << ""
out << @additional_zone_content out << @additional_zone_content