diff options
Diffstat (limited to 'whoseip/whoseip.pl')
-rw-r--r-- | whoseip/whoseip.pl | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/whoseip/whoseip.pl b/whoseip/whoseip.pl index 9ca899e..d64280e 100644 --- a/whoseip/whoseip.pl +++ b/whoseip/whoseip.pl @@ -458,6 +458,8 @@ sub serve { } $res{range} = cidr_to_range($res{cidr}); $res{count} = range2count($res{range}); + $res{term} = $term; + $res{source} = 'CACHE'; return %res; } } @@ -491,6 +493,7 @@ sub serve { $res{status} = 'BAD'; $res{diag} = 'invalid input'; } + $res{source} = 'QUERY'; $res{term} = $term; return %res; } @@ -758,15 +761,16 @@ if ($fastcgi) { local $/ = CRLF; $delim = "$CR$LF"; } + my $n = 1; while (<>) { chomp; - %res = serve($_); - format_out($output_format, %res); + format_out($output_format, serve($_), item => $n++); last if $single_query; } } else { + my $n = 1; foreach my $term (@ARGV) { - format_out($output_format, serve($term)); + format_out($output_format, serve($term), item => $n++); } } } @@ -781,10 +785,11 @@ whoseip - return information about IP address =head1 SYNOPSIS B<whoiseip> -[B<-dh>] +[B<-dhN>] [B<-F> I<FILE>] [B<-D> I<FILE>] [B<-i> I<FILE>] +[B<--cache-file=>I<FILE>] [B<--debug>] [B<--define-format=>I<NAME>B<=>I<TEXT>] [B<--dump=>I<FILE>] @@ -794,6 +799,7 @@ B<whoiseip> [B<--formfile=>I<FILE>] [B<--help>] [B<--ip-list=>I<FILE>] +[B<--no-cache>] [B<--single-query>] [B<--usage>] [I<IPADDR>...] @@ -918,6 +924,10 @@ output formats. =over 4 +=item B<--cache-file=>I<FILE> + +Cache retrieved data in file I<FILE>. + =item B<-D>, B<--dump=>I<FILE> Dump the program to I<FILE>. This is normally done to update the @@ -972,6 +982,10 @@ Comments are introduced with a B<#> sign. Empty lines are ignored. Without this option, B<whoseip> uses the built-in list of servers. +=item B<-N>, B<--no-cache> + +Disable caching (this is the default). + =item B<--single-query> This option is valid only in B<inetd mode>. It instructs B<whoseip> to @@ -1052,6 +1066,11 @@ B<NO>, if it was not, and B<BAD>, if the input was invalid. Contains explanatory text if B<${status}> is B<NO> or B<BAD>. If it is B<OK>, this macro is not defined. +=item B<${item}> + +Ordinal number of the request being served. Not defined in B<CGI> and +B<FastCGI> modes. + =item B<${term}> The input IP address. @@ -1072,6 +1091,12 @@ Number of IP addresses in the network. ISO 3166-1 code of the country where IP address is located. +=item B<${source}> + +Where the information was obtained from. B<QUERY>, if it was retrieved +from a remote B<whois> server and B<CACHE>, if it was read from the +cache database. + =back If a macro is not defined, the corresponding reference expands to |