����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
use NetAddr::IP qw(Compact);
# $Id: v4-compact.t,v 1.1.1.1 2006/08/14 15:36:06 lem Exp $
my @r = (
[ '10.0.0.0', '255.255.255.0'],
[ '11.0.0.0', '255.255.255.0'],
[ '12.0.0.0', '255.255.255.0'],
[ '20.0.0.0', '255.255.0.0'],
[ '30.0.0.0', '255.255.0.0'],
[ '40.0.0.0', '255.255.0.0'],
);
$| = 1;
if (defined($ENV{LIGHTERIPTESTS}) and $ENV{LIGHTERIPTESTS} =~ /yes/i) {
print "1..0 # Skipped: LIGHTERIPTESTS = yes\n";
exit 0;
}
print "1..9\n";
my @ips1;
for my $ip ('10.0.0.0', '11.0.0.0', '12.0.0.0') {
push @ips1, NetAddr::IP->new($ip, 24)->split(32);
}
for my $ip ('20.0.0.0', '30.0.0.0', '40.0.0.0') {
push @ips1, NetAddr::IP->new($ip, 16)->split(28);
}
my @ips2;
for my $num (0 .. 255) {
push @ips2, NetAddr::IP->new("192.168.$num.0", 24);
}
my $ips2_compact = '192.168.0.0/16';
# Compact(@)
#
compact_ips1_check(1, Compact(@ips1));
compact_ips2_check(2, Compact(@ips2));
# ->compact(@)
#
compact_ips1_check(3, $ips1[0]->compact(@ips1[1..$#ips1]));
compact_ips2_check(4, $ips2[0]->compact(@ips2[1..$#ips2]));
# Compact([])
#
compact_ips1_check(5, @{Compact(\@ips1)});
compact_ips2_check(6, @{Compact(\@ips2)});
# ->compactref([])
#
compact_ips1_check(7, @{$ips1[0]->compactref([@ips1[1..$#ips1]])});
compact_ips2_check(8, @{$ips2[0]->compactref([@ips2[1..$#ips2]])});
# duplicate IP
#
@ips1 = ();
for my $ip (qw(1.1.1.1 1.1.1.1 1.1.1.1 1.1.1.1)) {
push(@ips1, NetAddr::IP->new($ip));
}
@c = NetAddr::IP::compact(@ips1);
if (@c == 1 and $c[0]->cidr() eq '1.1.1.1/32') {
print "ok 9\n";
}
else {
print "not ok 9\n";
}
######################################################################
sub compact_ips1_check
{
my $num = shift;
my @ips = shift;
my @mips;
for my $ip (@ips) {
push @mips, grep { $ip->addr eq $_->[0] and $ip->mask eq $_->[1] } @r;
}
if (@mips == @ips) {
print "ok $num\n";
}
else {
print "not ok $num\n";
}
}
######################################################################
sub compact_ips2_check
{
my $num = shift;
my @ips = shift;
if (@ips == 1 and $ips[0] eq $ips2_compact) {
print "ok $num\n";
}
else {
print "not ok $num\n";
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| canon.t | File | 480 B | 0644 |
|
| constants.t | File | 488 B | 0644 |
|
| full.t | File | 721 B | 0644 |
|
| full6-uri.t | File | 727 B | 0644 |
|
| full6.t | File | 721 B | 0644 |
|
| imhoff.t | File | 873 B | 0644 |
|
| loops.t | File | 647 B | 0644 |
|
| lower.t | File | 220 B | 0644 |
|
| masklen.t | File | 345 B | 0644 |
|
| new-store.t | File | 812 B | 0644 |
|
| nofqdn.t | File | 437 B | 0644 |
|
| old-store.t | File | 841 B | 0644 |
|
| over-arr.t | File | 500 B | 0644 |
|
| over-qq.t | File | 800 B | 0644 |
|
| relops.t | File | 1.53 KB | 0644 |
|
| rfc3021.t | File | 627 B | 0644 |
|
| short.t | File | 1.7 KB | 0644 |
|
| splitref.t | File | 749 B | 0644 |
|
| v4-coalesce.t | File | 1.47 KB | 0644 |
|
| v4-compact.t | File | 2.18 KB | 0644 |
|
| v4-compplus.t | File | 531 B | 0644 |
|
| v4-hostenum.t | File | 1.02 KB | 0644 |
|
| v4-re.t | File | 826 B | 0644 |
|
| v4-split-bulk.t | File | 547 B | 0644 |
|
| v4-split-list.t | File | 1.17 KB | 0644 |
|
| v4-splitplan.t | File | 2.23 KB | 0644 |
|
| v4-sprefix.t | File | 779 B | 0644 |
|
| v4-xprefix.t | File | 773 B | 0644 |
|
| v6-re.t | File | 1.42 KB | 0644 |
|
| v6-split-bulk.t | File | 513 B | 0644 |
|
| v6-splitplan.t | File | 2.35 KB | 0644 |
|
| wildcard.t | File | 546 B | 0644 |
|