From: Tom Hughes Date: Mon, 12 Aug 2013 16:54:47 +0000 (+0100) Subject: Output A records for the default name instead of CNAME records X-Git-Url: https://git.openstreetmap.org./dns.git/commitdiff_plain/27a3dfe0c9ce66a7e2fb889260b9cdfffbc79856?ds=sidebyside Output A records for the default name instead of CNAME records --- diff --git a/bin/mkgeo b/bin/mkgeo index 33a05b0..dcc192a 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -225,11 +225,11 @@ while (my($name,$cluster) = each %$clusters) { if (my $default = $cluster->{default}) { - $zonefile->print("C${default}.${zone}:${name}.${zone}:600\n"); + output_server($zonefile, "${default}.${zone}", $cluster); } elsif (exists($cluster->{default})) { - $zonefile->print("C${zone}:${name}.${zone}:600\n"); + output_server($zonefile, "${zone}", $cluster); } } @@ -239,18 +239,7 @@ $zonefile->print("# Servers\n"); # Output A records for each cluster while (my($name,$cluster) = each %$clusters) { - foreach my $server (@{$cluster->{servers}}) - { - if ($server->{status} eq "up") - { - $zonefile->print("+${name}.${zone}:$server->{ipv4}:600\n"); - - if ($server->{ipv6}) - { -# $zonefile->print("3${name}.${zone}:$server->{ipv6}:600\n"); - } - } - } + output_server($zonefile, "${name}.${zone}", $cluster); } # Output the GeoJSON text @@ -394,3 +383,28 @@ sub compare_bandwidth return $a_used <=> $b_used; } + +# +# Output DNS records for a server +# +sub output_server +{ + my $zonefile = shift; + my $name = shift; + my $cluster = shift; + + foreach my $server (@{$cluster->{servers}}) + { + if ($server->{status} eq "up") + { + $zonefile->print("+${name}:$server->{ipv4}:600\n"); + + if ($server->{ipv6}) + { +# $zonefile->print("3${name}:$server->{ipv6}:600\n"); + } + } + } + + return; +}