-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
prod: | ||
rsync -av * gigo.com:/var/www/fsky-dns.test-ipv6.com/. --delete | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#! /usr/bin/perl | ||
|
||
use JSON::PP; | ||
|
||
use strict; | ||
|
||
my %data; | ||
|
||
$data{"domain"} = <<'EOF'; | ||
;################################################################ | ||
;# ZONE: $argv{domain}. | ||
;# Put this on your real name servers. Fix the SOA and NS | ||
;# to reflect your environment. | ||
;################################################################ | ||
$TTL 300 | ||
@ IN SOA $argv{ns}. $argv{hostmaster}. ( | ||
$argv{serial} ; Serial | ||
86400 ; Refresh | ||
7200 ; Retry | ||
604800 ; Expire | ||
172800) ; Minimum | ||
; Main web site is intentionally IPv4 only, per the FAQ. | ||
A $argv{4} | ||
www A $argv{4} | ||
; Specific records for tests | ||
ipv4 A $argv{4} | ||
ipv6 AAAA $argv{6} | ||
mtu1280 AAAA $argv{1280} | ||
ds A $argv{4} | ||
ds AAAA $argv{6} | ||
; DNS recursive resolver testing; | ||
; Delegated to the VM running $argv{domain}; IPv6-only | ||
v6ns ns v6ns1 | ||
v6ns1 AAAA $argv{6} | ||
; buggydns detects CPE devices that misinterpret AAAA | ||
; requests for A; the buggy CPE will return either the | ||
; first or last 32 bits. | ||
; Do not use where IPv4 is between 32.0.0.0 and 63.255.255.255. | ||
;buggydns1 AAAA $argv{buggy} | ||
; Convenience names not used in the tests; | ||
; but perhaps friendly for humans | ||
a A $argv{4} | ||
aaaa AAAA $argv{6} | ||
www4 A $argv{4} | ||
www6 AAAA $argv{6} | ||
v4 A $argv{4} | ||
v6 AAAA $argv{6} | ||
EOF | ||
|
||
$data{"v6ns"} = <<'EOF'; | ||
;################################################################ | ||
;# ZONE: v6ns.$argv{domain}. | ||
;# Put this on the VM operating your test-ipv6.com mirror. | ||
;# Do NOT put this on your main DNS server. | ||
;################################################################ | ||
$TTL 300 | ||
@ IN SOA v6ns1.$argv{domain}. $argv{hostmaster}. ( | ||
$argv{serial} ; Serial | ||
86400 ; Refresh | ||
7200 ; Retry | ||
604800 ; Expire | ||
172800) ; Minimum | ||
NS v6ns1.$argv{domain}. | ||
; Specific records for tests | ||
ipv4 A $argv{4} | ||
ipv6 AAAA $argv{6} | ||
ds A $argv{4} | ||
ds AAAA $argv{6} | ||
a A $argv{4} | ||
aaaa AAAA $argv{6} | ||
www4 A $argv{4} | ||
www6 AAAA $argv{6} | ||
v4 A $argv{4} | ||
v6 AAAA $argv{6} | ||
EOF | ||
|
||
$data{"v6ns1"} = <<'EOF'; | ||
;################################################################ | ||
;# ZONE: v6ns1.$argv{domain}. | ||
;# Put this on the VM operating your test-ipv6.com mirror. | ||
;# Do NOT put this on your main DNS server. | ||
;################################################################ | ||
$TTL 300 | ||
@ IN SOA v6ns1.$argv{domain}. $argv{hostmaster}. ( | ||
$argv{serial} ; Serial | ||
86400 ; Refresh | ||
7200 ; Retry | ||
604800 ; Expire | ||
172800) ; Minimum | ||
NS v6ns1.$argv{domain}. | ||
AAAA $argv{6} | ||
EOF | ||
|
||
my $coder = JSON::PP->new->ascii->pretty->allow_nonref; | ||
my $pretty_printed = $coder->pretty->encode( \%data ); # pretty-printing | ||
|
||
open FILE, ">templates.js" or die "failed to create templates.js: $!"; | ||
print FILE <<"EOF"; | ||
// GENERATED OUTPUT run ./generate.pl to upate. | ||
templates = $pretty_printed; | ||
EOF | ||
|
||
close FILE; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
body { | ||
font-family: sans-serif | ||
} | ||
#domain { | ||
background-color: #fee | ||
} | ||
#v6ns1 { | ||
background-color: #ffe | ||
} | ||
#v6ns { | ||
background-color: #ffe | ||
} | ||
|
||
input[type="text"] { | ||
display: block; | ||
margin: 0; | ||
width: 100%; | ||
font-family: sans-serif; | ||
font-size: 18px; | ||
appearance: none; | ||
box-shadow: none; | ||
border-radius: none; | ||
padding: 10px; | ||
border: solid 1px #dcdcdc; | ||
transition: box-shadow 0.3s, border 0.3s; | ||
} | ||
input[type="text"]:focus { | ||
outline: none; | ||
border: solid 1px #707070; | ||
box-shadow: 0 0 5px 1px #969696; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | ||
<head> | ||
<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" /> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
|
||
<title>falling-sky dns generator.</title> | ||
<link rel="stylesheet" href="index.css" type="text/css" /> | ||
<script type="text/javascript" src="jquery-2.2.1.min.js"></script> | ||
<script type="text/javascript" src="index.js"></script> | ||
<script type="text/javascript" src="templates.js"></script> | ||
|
||
<body> | ||
<div id="formcontainer"> | ||
<form id="form" action="javascript:update_templates();true;"> | ||
<table> | ||
<tr><td>Domain Name:</td><td> <input type="text" size="40" id="form_domain" value="test-ipv6.example.org"></td><tr> | ||
<tr><td>Primary NS (for SOA):</td><td> <input type="text" size="40" id="form_ns" value="ns1.example.org"></td></tr> | ||
<tr><td>Hostmaster (for SOA):</td><td> <input type="text" size="40" id="form_hostmaster" value="hostmaster.example.org"></td></tr> | ||
<tr><td colspan=2><hr></td></tr> | ||
<tr><td>IPv4:</td><td> <input type="text" size="40" id="form_4" value="192.0.2.1"></td></tr> | ||
<tr><td>IPv6 #1 (most tests):</td><td> <input type="text" size="40" id="form_6" value="2001:db8::1"></td></tr> | ||
<tr><td>IPv6 #2 (for mtu1280):</td><td> <input type="text" size="40" id="form_1280" value="2001:db8::1280"></td></tr> | ||
<tr><td colspan=2><hr></td></tr> | ||
</table> | ||
<input type="hidden" id="form_buggy" value="::"> | ||
<input type="hidden" id="form_serial" value="::"> | ||
</form> | ||
</div> | ||
|
||
|
||
<div id="domain"> | ||
<div> | ||
<pre><code id="code_domain"></code></pre> | ||
</div> | ||
<hr> | ||
|
||
<div id="v6ns1"> | ||
<div> | ||
<pre><code id="code_v6ns1"></code></pre> | ||
</div> | ||
<hr> | ||
|
||
<div id="v6ns"> | ||
<div> | ||
<pre><code id="code_v6ns"></code></pre> | ||
</div> | ||
<hr> | ||
|
||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
var files = [ "v6ns","domain","v6ns1"]; | ||
var variables = [ "domain","ns","hostmaster","4","6","1280","buggy","serial" ]; | ||
|
||
|
||
function update_serial() { | ||
// Borrowed from http://stackoverflow.com/questions/1531093/how-to-get-current-date-in-javascript | ||
// http://stackoverflow.com/users/525895/samuel-meddows | ||
var today = new Date(); | ||
var dd = today.getDate(); | ||
var mm = today.getMonth()+1; //January is 0! | ||
var yyyy = today.getFullYear(); | ||
|
||
if(dd<10) { | ||
dd='0'+dd | ||
} | ||
|
||
if(mm<10) { | ||
mm='0'+mm | ||
} | ||
$("#form_serial").val( yyyy + mm + dd ); | ||
|
||
} | ||
function update_buggydns() { | ||
ipv4 = $("#form_4").val(); | ||
parts = ipv4.split("."); | ||
s = ""; | ||
for (i=0; i < parts.length; i++) { | ||
val = parseInt(parts[i],10); | ||
hex = val.toString(16); | ||
if (hex.length == 1) { | ||
hex = "0" + hex; | ||
} | ||
s = s + hex; | ||
} | ||
r = s.substring(0,4) + ":" + s.substring(4,8) + ":" + | ||
s.substring(0,4) + ":" + s.substring(4,8) + ":" + | ||
s.substring(0,4) + ":" + s.substring(4,8) + ":" + | ||
s.substring(0,4) + ":" + s.substring(4,8); | ||
$("#form_buggy").val(r) | ||
|
||
if (parts[0] < 32) { | ||
return true; | ||
} | ||
if (parts[0] > 63) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
|
||
function update_templates() { | ||
try { | ||
update_serial(); | ||
safe=update_buggydns() | ||
} catch (err) { | ||
} | ||
|
||
for (i=0; i < files.length; i++) { | ||
file = files[i]; | ||
template = templates[file]; | ||
|
||
if (safe) { | ||
template = template.replace(/;buggydns1/,'buggydns1'); | ||
} | ||
|
||
for (j=0; j < variables.length; j++) { | ||
variable = variables[j]; | ||
find = "#form_" + variable; | ||
found = $(find).val(); | ||
if (found.length > 0) { | ||
re = new RegExp('[$]argv[{]' + variable + '[}]','gi'); | ||
template = template.replace(re,found); | ||
} | ||
} | ||
divid = '#code_' + file; | ||
jQuery(divid).text(template); | ||
} | ||
} | ||
|
||
function set_handlers() { | ||
for (j=0; j < variables.length; j++) { | ||
variable = variables[j]; | ||
find = "#form_" + variable; | ||
$(find).change(update_templates) | ||
$(find).blur(update_templates) | ||
} | ||
} | ||
|
||
|
||
$( document ).ready(function() { | ||
// Your code here. | ||
set_handlers(); | ||
update_templates(); | ||
}); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.