Net-Whois-Raw

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

15
16
17
18
19
20
21
22
23
24
25
26
27
28
maintain/pwhois-maintain.pl
maintain/pwhois-maintain/func.js
maintain/pwhois-maintain/index.html
maintain/pwhois-maintain/logic.js
t/01-local.t
t/02-www_parse_tj_cgi_whois.t
t/03-read_write_cache.t
t/04-qrycache.t
t/all_tlds.pl
t/author-pod-spell.t
t/coro-domains.pl
t/example-domains-load-balancing.pl
t/internet.pl
t/ipv6.pl

lib/Net/Whois/Raw/Data.pm  view on Meta::CPAN

1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
XN--CLCHC0EA0B2G2A9GCD  whois.sgnic.sg
XN--YFRO4I67O           whois.sgnic.sg
 
XN--O3CW4H              whois.thnic.co.th
 
XN--NODE                whois.itdc.ge
 
XN--3E0B707E            whois.kr
XN--CG4BKI              whois.kr
 
SANDVIKCOROMANT         whois.nic.sandvikcoromant
 
SCOR                    whois.nic.scor
 
SEVEN                   whois.nic.seven
 
SYDNEY                  whois.nic.sydney
 
TDK                     whois.nic.tdk
 
TEVA                    whois.nic.teva

lib/Net/Whois/Raw/Data.pm  view on Meta::CPAN

2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
'whois.nic.xn--w4r85el8fhu5dnra'       => 'No match for "',
'whois.nic.xn--w4rs40l'                => 'No match for "',
'whois.nic.xperia'                     => 'No match for "',
'whois.nic.zm'                         => 'Domain Status: No Object Found',
'whois.pnina.ps'                       => 'Domain Status: No Object Found',
'whois.registry.knet.cn'               => 'The queried object does not exist: ',
'whois.sgnic.sg'                       => 'Domain Not Found',
'whois.thnic.co.th'                    => 'No match for',
'whois.itdc.ge'                        => 'NO OBJECT FOUND',
'whois.kr'                             => 'The requested domain was not found',
'whois.nic.sandvikcoromant'            => 'No Data Found',
'whois.nic.scor'                       => 'No Data Found',
'whois.nic.seven'                      => 'No Data Found',
'whois.nic.sydney'                     => 'No Data Found',
'whois.nic.tdk'                        => 'No Data Found',
'whois.nic.teva'                       => 'No Data Found',
'whois.nic.trust'                      => 'No Data Found',
'whois.nic.virgin'                     => 'No Data Found',
'whois.nic.vistaprint'                 => 'No Data Found',
'whois.nic.walter'                     => 'No Data Found',
'whois.nic.woodside'                   => 'No Data Found',

t/coro-domains.pl  view on Meta::CPAN

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
BEGIN {
        use Socket;
         
        eval "
                use Coro;
                use Coro::AnyEvent;
                use Coro::Socket;
                use Coro::LWP;
        ";
         
        $::require_coro = $@ if $@;
 
    use_ok('Net::Whois::Raw',qw( whois ));
 
    $Net::Whois::Raw::CHECK_FAIL = 1;
    $Net::Whois::Raw::OMIT_MSG = 1;
    $Net::Whois::Raw::CHECK_EXCEED = 1;
};
 
my @domains = qw(
    yahoo.com

t/coro-domains.pl  view on Meta::CPAN

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    belizenic.bz
);
 
my $dns_cache = {};
 
SKIP: {
    print "The following tests requires internet connection. Checking...\n";
    skip "Looks like no internet connection", 5 unless get_connected();
     
    print "The following tests requires Coro. Checking...\n";
    skip "Looks like no Coro installed", 5 unless require_coro ();
     
    my @coros = ();
     
    # domains
    foreach my $domain ( @domains ) {
        push @coros, Coro->new (sub {
            my $txt = whois( $domain );
            $domain =~ s/.NS$//i;
            ok($txt && $txt =~ /$domain/i, "domain '$domain' resolved");
        });
    }
     
    $_->ready foreach @coros;
     
    $_->join foreach @coros;
     
};
 
sub get_connected {
    require LWP::UserAgent;
    my $ua = LWP::UserAgent->new( timeout => 10 );
    my $res = $ua->get( 'http://www.google.com' );
     
    return $res->is_success;
}
 
sub require_coro {
         
        no warnings 'once';
         
        *Net::Whois::Raw::whois_socket_fixup = sub {
                my $class = shift;
                my $sock  = shift;
                 
                return Coro::Socket->new_from_fh ($sock, partial => 1);
        };
        

t/coro-domains.pl  view on Meta::CPAN

87
88
89
90
91
92
93
94
95
96
97
98
                }
                 
                return (
                        PeerAddr => $dns_cache->{$name},
                        PeerPort => 43,
                        # LocalHost => ,
                        # LocalPort =>
                );
        };
         
        return ! $::require_coro;
}

t/example-domains-load-balancing.pl  view on Meta::CPAN

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
eval "
        use Coro;
        use Coro::AnyEvent;
        use Coro::Socket;
        use Coro::LWP;
        use Coro::Timer;
        use DBI:SQLite;
";
 
$::require_coro = $@ if $@;
 
unlink "db.sqlite";
 
$ENV{DBI_DSN}  ||= 'DBI:SQLite:dbname=db.sqlite';
$ENV{DBI_USER} ||= '';
$ENV{DBI_PASS} ||= '';
 
use DBI;
 
$::dbh = DBI->connect;

t/example-domains-load-balancing.pl  view on Meta::CPAN

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    belizenic.bz
);
 
my $dns_cache = {};
 
SKIP: {
    print "The following tests requires internet connection. Checking...\n";
    skip "Looks like no internet connection", 5 unless get_connected();
     
    print "The following tests requires Coro. Checking...\n";
    skip "Looks like no Coro installed", 5 unless require_coro ();
     
    my @coros = ();
     
    # domains
    foreach my $domain ( @domains ) {
        push @coros, Coro->new (sub {
            my $txt = whois( $domain );
            $::dbh->do ('delete from whois_connection where domain = ?', {}, $domain);
            $domain =~ s/.NS$//i;
            ok($txt && $txt =~ /$domain/i, "domain '$domain' resolved");
        });
    }
     
    $_->ready foreach @coros;
     
    $_->join foreach @coros;
     
};
 
sub get_connected {
    require LWP::UserAgent;
    my $ua = LWP::UserAgent->new( timeout => 10 );
    my $res = $ua->get( 'http://www.google.com' );
     
    return $res->is_success;
}
 
sub require_coro {
         
        no warnings 'once';
         
        *Net::Whois::Raw::whois_socket_fixup = sub {
                my $class = shift;
                my $sock  = shift;
                 
                return Coro::Socket->new_from_fh ($sock, partial => 1);
        };
        

t/example-domains-load-balancing.pl  view on Meta::CPAN

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
my $class  = shift;
my $domain = shift;
my $name   = shift;
 
# TODO: YOU MUST PLACE QUOTA CHECK HERE
# my $sth = $::dbh->prepare ('select * from ');
 
my $ip;
 
if (! $dns_cache->{$name}) {
        $ip = inet_ntoa (inet_aton ($name)); # TODO: use coro::util for resolve
        $dns_cache->{$name} = $ip;
} else {
        $ip = $dns_cache->{$name};
}
 
my $ip_num = ip_to_dword ($ip);
 
my $sth = $::dbh->prepare (
        'select local_ip from whois_ip where local_ip not in (select local_ip from whois_connection where remote_ip = ? group by local_ip) limit 1;'
);

t/example-domains-load-balancing.pl  view on Meta::CPAN

165
166
167
168
169
170
171
172
173
174
175
176
                );
                 
                return (
                        PeerAddr => $dns_cache->{$name},
                        PeerPort => 43,
                        LocalHost => dword_to_ip ($result->[0]->{local_ip}),
                        # LocalPort =>
                );
        };
         
        return ! $::require_coro;
}



( run in 0.337 second using v1.01-cache-2.11-cpan-8d75d55dd25 )