diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-10-19 09:46:41 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2014-10-19 09:46:41 +0300 |
commit | d8b056b5f2edea6a19ba3ebd7accc6892fa48908 (patch) | |
tree | b0367c43ab7ae721dd658a1ede6312991cc5b418 /whoseip/Whoseip/DB.pm | |
parent | 2166295b26a7b69481148e55b36fedfea84ea413 (diff) | |
download | dnstools-d8b056b5f2edea6a19ba3ebd7accc6892fa48908.tar.gz dnstools-d8b056b5f2edea6a19ba3ebd7accc6892fa48908.tar.bz2 |
whoseip: recover gracefully after cache failures
* whoseip/Makefile.PL (WriteMakefile): Use VERSION_FROM.
* whoseip/Whoseip/DB.pm (ipdb_lookup_unlocked): Add more data to the
output.
* whoseip/whoseip.pl: Protect ipdb_ calls by eval.
(output): Rename to expandout.
(format_out): Rename to print_result.
Document return codes.
Diffstat (limited to 'whoseip/Whoseip/DB.pm')
-rw-r--r-- | whoseip/Whoseip/DB.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/whoseip/Whoseip/DB.pm b/whoseip/Whoseip/DB.pm index 5cc36c9..a824491 100644 --- a/whoseip/Whoseip/DB.pm +++ b/whoseip/Whoseip/DB.pm @@ -37,7 +37,7 @@ our @EXPORT_OK = ( qw(ipdb_open ipdb_lookup ipdb_insert our @EXPORT = qw(); -our $VERSION = "0.1"; +our $VERSION = "1.0"; my %ipv4_mask2len; my @ipv4_len2mask; @@ -772,7 +772,10 @@ sub ipdb_lookup_unlocked($$) { } my %res = ( country => $r->[3], network => inet_ntoa(pack('N', $r->[0])), - netmask => inet_ntoa(pack('N', $r->[1])) ); + netmask => inet_ntoa(pack('N', $r->[1])), + timestamp => $r->[2], + ttl => time - $r->[2], + version => $VERSION ); @res{keys %{$r->[4]}} = values %{$r->[4]} if (defined($r->[4]) and ref($r->[4]) eq 'HASH'); return %res; |