Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

IP::Country::DNSBL
IP geolocation via DNS

IP::Country::DNSBL - IP geolocation via DNS


SYNOPSIS


  use IP::Country::DNSBL;

  my $reg = IP::Country::DNSBL->new();

  print $reg->inet_atocc('212.67.197.128')   ."\n";

  print $reg->inet_atocc('www.slashdot.org') ."\n";


DESCRIPTION

Finding the home country of a client using only the IP address can be difficult. Looking up the domain name associated with that address can provide some help, but many IP address are not reverse mapped to any useful domain, and the most common domain (.com) offers no help when looking for country.

This module queries a DNSBL server to find the correct country code.


CONSTRUCTOR

The constructor zero or one arguments.


  use IP::Country::DNSBL;

  my $reg = IP::Country::DNSBL->new();

The optional argument is a DNSBL domain name (e.g. country.example.net) which will be appended to any country code lookup. Without this argument, the module defaults to querying country.netop.org.


OBJECT METHODS

All object methods are designed to be used in an object-oriented fashion.


  $result = $object->foo_method($bar,$baz);

Using the module in a procedural fashion (without the arrow syntax) won't work.

$cc = $reg->inet_atocc(HOSTNAME)
Takes a string giving the name of a host, and translates that to an two-letter country code. Takes arguments of both the 'rtfm.mit.edu' type and '18.181.0.24'. If the host name cannot be resolved, returns undef. If the resolved IP address is not contained within the database, returns undef. For multi-homed hosts (hosts with more than one address), the first address found is returned.

$cc = $reg->inet_ntocc(IP_ADDRESS)
Takes a string (an opaque string as returned by Socket::inet_aton()) and translates it into a two-letter country code. If the IP address is not contained within the database, returns undef.


BUGS/LIMITATIONS

Only works with IPv4 addresses and ASCII hostnames.


SEE ALSO

http://www.netop.org/geoip.html - NetOp: IP geolocation via DNS

the IP::Country::Fast manpage - uses local database for lookups.


COPYRIGHT

Copyright (C) 2006, Nigel Wetters Gourlay.

NO WARRANTY. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy