1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-07-01 22:30:19 +02:00

daemon: break extracting myip down into smaller parts

This commit is contained in:
cn
2018-02-02 16:14:28 +01:00
parent 6080e14356
commit 08eaacb6ab
4 changed files with 53 additions and 59 deletions

View File

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

View File

@ -34,9 +34,8 @@ module Dyndnsd
end
end
def get_success_body(states, ip)
ips = ip.is_a?(Array) ? ip.join(' ') : ip
states.map { |state| "#{state} #{ips}" }.join("\n")
def get_success_body(changes, myips)
changes.map { |change| "#{change} #{myips.join(' ')}" }.join("\n")
end
def get_error_response_map

View File

@ -34,10 +34,8 @@ module Dyndnsd
end
end
def get_success_response(states, ip)
ips = ip.is_a?(Array) ? ip.join(' ') : ip
states.map { |state| state == :good ? "Changed to #{ips}" : "No change needed for #{ips}" }.join("\n")
def get_success_body(changes, myips)
changes.map { |change| change == :good ? "Changed to #{myips.join(' ')}" : "No change needed for #{myips.join(' ')}" }.join("\n")
end
def get_error_response_map