commit
a1a3f20ac7
|
@ -19,6 +19,12 @@ attribution github => ['https://github.com/seanheaton','seanheaton'],
|
|||
twitter => ['http://twitter.com/seanograph','@seanograph'],
|
||||
email => ['mailto:seanoftime@gmail.com','seanoftime@gmail.com'];
|
||||
|
||||
my $css = share('style.css')->slurp;
|
||||
sub append_css {
|
||||
my $html = shift;
|
||||
return "<style type='text/css'>$css</style>$html";
|
||||
}
|
||||
|
||||
handle remainder => sub {
|
||||
my @output = ();
|
||||
|
||||
|
@ -37,7 +43,7 @@ handle remainder => sub {
|
|||
|
||||
# negation of bits 96 to 128 designate IPv4 address of NAT device
|
||||
push @output, (new Net::IP (Net::IP::ip_bintoip(~(substr $binip, 96, 32),4)));
|
||||
return answer => to_text(@output), html => to_html(@output);
|
||||
return answer => to_text(@output), html => append_css(to_html(@output));
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -49,7 +55,9 @@ handle remainder => sub {
|
|||
|
||||
# Params: server, port, client
|
||||
sub to_html {
|
||||
return "<div><i>Teredo Server IPv4: </i>" . $_[0]->ip() . "</div><div><i>NAT Public IPv4: </i>" . $_[2]->ip() . "</div><div><i>Client Port: </i>" . $_[1] . "</div>";
|
||||
return "<div><span class=\"teredo__label text--secondary\">Teredo Server IPv4: </span><span class=\"text--primary\">" . $_[0]->ip()
|
||||
. "</span></div><div><span class=\"teredo__label text--secondary\">NAT Public IPv4: </span><span class=\"text--primary\">" . $_[2]->ip()
|
||||
. "</span></div><div><span class=\"teredo__label text--secondary\">Client Port: </span><span class=\"text--primary\">" . $_[1] . "</span></div>";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
.zci--answer .teredo__label {
|
||||
display: inline-block;
|
||||
min-width: 130px
|
||||
}
|
|
@ -15,16 +15,13 @@ ddg_goodie_test(
|
|||
|
||||
# Sample queries
|
||||
'teredo 2001:0000:4136:e378:8000:63bf:3fff:fdd2' =>
|
||||
test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 192.0.2.45\nClient Port: 40000",
|
||||
html => "<div><i>Teredo Server IPv4: </i>65.54.227.120</div><div><i>NAT Public IPv4: </i>192.0.2.45</div><div><i>Client Port: </i>40000</div>",),
|
||||
test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 192.0.2.45\nClient Port: 40000", html => qr/.*/),
|
||||
|
||||
'teredo 2001:0000:4136:E378:8000:EC77:7C94:FFFE' =>
|
||||
test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 131.107.0.1\nClient Port: 5000",
|
||||
html => "<div><i>Teredo Server IPv4: </i>65.54.227.120</div><div><i>NAT Public IPv4: </i>131.107.0.1</div><div><i>Client Port: </i>5000</div>",),
|
||||
test_zci("Teredo Server IPv4: 65.54.227.120\nNAT Public IPv4: 131.107.0.1\nClient Port: 5000", html => qr/.*/),
|
||||
|
||||
'teredo 2001::CE49:7601:E866:EFFF:62C3:FFFE' =>
|
||||
test_zci("Teredo Server IPv4: 206.73.118.1\nNAT Public IPv4: 157.60.0.1\nClient Port: 4096",
|
||||
html => "<div><i>Teredo Server IPv4: </i>206.73.118.1</div><div><i>NAT Public IPv4: </i>157.60.0.1</div><div><i>Client Port: </i>4096</div>",),
|
||||
test_zci("Teredo Server IPv4: 206.73.118.1\nNAT Public IPv4: 157.60.0.1\nClient Port: 4096", html => qr/.*/)
|
||||
);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue