HEX
Server: LiteSpeed
System: Linux CentOS-79-64-minimal 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: vishn3436 (5293)
PHP: 8.0.15
Disabled: NONE
Upload Files
File: //usr/local/share/man/man3/Geo::IP.3pm
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
.    if \nF \{
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Geo::IP 3"
.TH Geo::IP 3 "2017-10-12" "perl v5.16.3" "User Contributed Perl Documentation"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Geo::IP \- Look up location and network information by IP Address
.SH "VERSION"
.IX Header "VERSION"
version 1.51
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 7
\&  use Geo::IP;
\&  my $gi = Geo::IP\->new(GEOIP_MEMORY_CACHE);
\&  # look up IP address \*(Aq24.24.24.24\*(Aq
\&  # returns undef if country is unallocated, or not defined in our database
\&  my $country = $gi\->country_code_by_addr(\*(Aq24.24.24.24\*(Aq);
\&  $country = $gi\->country_code_by_name(\*(Aqyahoo.com\*(Aq);
\&  # $country is equal to "US"
\&
\&
\&  use Geo::IP;
\&  my $gi = Geo::IP\->open("/usr/local/share/GeoIP/GeoIPCity.dat", GEOIP_STANDARD);
\&  my $record = $gi\->record_by_addr(\*(Aq24.24.24.24\*(Aq);
\&  print $record\->country_code,
\&        $record\->country_code3,
\&        $record\->country_name,
\&        $record\->region,
\&        $record\->region_name,
\&        $record\->city,
\&        $record\->postal_code,
\&        $record\->latitude,
\&        $record\->longitude,
\&        $record\->time_zone,
\&        $record\->area_code,
\&        $record\->continent_code,
\&        $record\->metro_code;
\&
\&
\&  # the IPv6 support is currently only avail if you use the CAPI which is much
\&  # faster anyway. ie: print Geo::IP\->api equals to \*(AqCAPI\*(Aq
\&  use Socket;
\&  use Socket6;
\&  use Geo::IP;
\&  my $g = Geo::IP\->open(\*(Aq/usr/local/share/GeoIP/GeoIPv6.dat\*(Aq) or die;
\&  print $g\->country_code_by_ipnum_v6(inet_pton AF_INET6, \*(Aq::24.24.24.24\*(Aq);
\&  print $g\->country_code_by_addr_v6(\*(Aq2a02:e88::\*(Aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This module uses the GeoIP Legacy file based database.  This database simply
contains \s-1IP\s0 blocks as keys, and countries as values. This database should be
more complete and accurate than reverse \s-1DNS\s0 lookups.
.PP
This module can be used to automatically select the geographically closest
mirror, to analyze your web server logs to determine the countries of your
visitors, for credit card fraud detection, and for software export controls.
.SH "IP GEOLOCATION USAGE"
.IX Header "IP GEOLOCATION USAGE"
\&\s-1IP\s0 geolocation is inherently imprecise. Locations are often near the center of
the population. Any location provided by a GeoIP database or web service
should not be used to identify a particular address or household.
.SH "IP ADDRESS TO COUNTRY DATABASES"
.IX Header "IP ADDRESS TO COUNTRY DATABASES"
Free monthly updates to the database are available from
.PP
.Vb 1
\&  http://dev.maxmind.com/geoip/geolite
.Ve
.PP
This free database is similar to the database contained in IP::Country, as
well as many paid databases. It uses \s-1ARIN, RIPE, APNIC,\s0 and \s-1LACNIC\s0 whois to
obtain the \s-1IP\-\s0>Country mappings.
.PP
If you require greater accuracy, MaxMind offers a database on a paid
subscription basis.  Also included with this is a service that updates your
database automatically each month, by running a program called geoipupdate
included with the C \s-1API\s0 from a cronjob.  For more details on the differences
between the free and paid databases, see:
.PP
http://www.maxmind.com/en/geolocation_landing
.PP
Do not miss the city database, described in Geo::IP::Record
.PP
Make sure to use the \fIgeolite\-mirror\-simple.pl\fR script from the example directory to
stay current with the databases.
.SH "BENCHMARK the lookups are fast. This is my laptop ( examples/benchmark.pl ):"
.IX Header "BENCHMARK the lookups are fast. This is my laptop ( examples/benchmark.pl ):"
.Vb 9
\&  Benchmark: running city_mem, city_std, country_mem, country_std, country_v6_mem, country_v6_std, isp_mem, isp_std for at least 10 CPU seconds...
\&    city_mem: 10.3121 wallclock secs (10.30 usr +  0.01 sys = 10.31 CPU) @ 387271.48/s (n=3992769)
\&    city_std: 10.0658 wallclock secs ( 2.86 usr +  7.17 sys = 10.03 CPU) @ 54392.62/s (n=545558)
\&  country_mem: 10.1772 wallclock secs (10.16 usr +  0.00 sys = 10.16 CPU) @ 1077507.97/s (n=10947481)
\&  country_std: 10.1432 wallclock secs ( 2.30 usr +  7.85 sys = 10.15 CPU) @ 83629.56/s (n=848840)
\&  country_v6_mem: 10.2579 wallclock secs (10.25 usr + \-0.00 sys = 10.25 CPU) @ 365997.37/s (n=3751473)
\&  country_v6_std: 10.8541 wallclock secs ( 1.77 usr +  9.07 sys = 10.84 CPU) @ 10110.42/s (n=109597)
\&     isp_mem: 10.147 wallclock secs (10.13 usr +  0.01 sys = 10.14 CPU) @ 590109.66/s (n=5983712)
\&     isp_std: 10.0484 wallclock secs ( 2.71 usr +  7.33 sys = 10.04 CPU) @ 73186.35/s (n=734791)
.Ve
.SH "CLASS METHODS"
.IX Header "CLASS METHODS"
.ie n .IP "$gi = Geo::IP\->new( $flags );" 4
.el .IP "\f(CW$gi\fR = Geo::IP\->new( \f(CW$flags\fR );" 4
.IX Item "$gi = Geo::IP->new( $flags );"
Constructs a new Geo::IP object with the default database located inside your system's
\&\fIdatadir\fR, typically \fI/usr/local/share/GeoIP/GeoIP.dat\fR.
.Sp
Flags can be set to either \s-1GEOIP_STANDARD,\s0 or for faster performance (at a
cost of using more memory), \s-1GEOIP_MEMORY_CACHE.\s0 When using memory cache you
can force a reload if the file is updated by setting \s-1GEOIP_CHECK_CACHE.
GEOIP_INDEX_CACHE\s0 caches the most frequently accessed index portion of the
database, resulting in faster lookups than \s-1GEOIP_STANDARD,\s0 but less memory
usage than \s-1GEOIP_MEMORY_CACHE \-\s0 useful for larger databases such as GeoIP
Legacy Organization and GeoIP City. Note, for GeoIP Country, Region and
Netspeed databases, \s-1GEOIP_INDEX_CACHE\s0 is equivalent to \s-1GEOIP_MEMORY_CACHE.\s0
.Sp
Prior to geoip-api version 1.6.3, the C \s-1API\s0 would leak diagnostic messages
onto stderr unconditionally. From Geo::IP v1.44 onwards, the flag
squelching this behavior (\s-1GEOIP_SILENCE\s0) is implicitly added to the flags
passed in \fInew()\fR, \fIopen()\fR, and \fIopen_type()\fR.
.Sp
To combine flags, use the bitwise \s-1OR\s0 operator, |.  For example, to cache the
database in memory, but check for an updated GeoIP.dat file, use:
Geo::IP\->new( \s-1GEOIP_MEMORY_CACHE\s0 | \s-1GEOIP_CHECK_CACHE \s0);
.ie n .IP "$gi = Geo::IP\->open( $database_filename, $flags );" 4
.el .IP "\f(CW$gi\fR = Geo::IP\->open( \f(CW$database_filename\fR, \f(CW$flags\fR );" 4
.IX Item "$gi = Geo::IP->open( $database_filename, $flags );"
Constructs a new Geo::IP object with the database located at \f(CW$database_filename\fR.
.ie n .IP "$gi = Geo::IP\->open_type( $database_type, $flags );" 4
.el .IP "\f(CW$gi\fR = Geo::IP\->open_type( \f(CW$database_type\fR, \f(CW$flags\fR );" 4
.IX Item "$gi = Geo::IP->open_type( $database_type, $flags );"
Constructs a new Geo::IP object with the \f(CW$database_type\fR database located in
the standard location.  For example
.Sp
.Vb 1
\&  $gi = Geo::IP\->open_type( GEOIP_CITY_EDITION_REV1 , GEOIP_STANDARD );
.Ve
.Sp
opens the database file in the standard location for GeoIP Legacy City,
typically \fI/usr/local/share/GeoIP/GeoIPCity.dat\fR.
.SH "OBJECT METHODS"
.IX Header "OBJECT METHODS"
.ie n .IP "$code = $gi\->country_code_by_addr( $ipaddr );" 4
.el .IP "\f(CW$code\fR = \f(CW$gi\fR\->country_code_by_addr( \f(CW$ipaddr\fR );" 4
.IX Item "$code = $gi->country_code_by_addr( $ipaddr );"
Returns the \s-1ISO 3166\s0 country code for an \s-1IP\s0 address.
.ie n .IP "$code = $gi\->country_code_by_name( $hostname );" 4
.el .IP "\f(CW$code\fR = \f(CW$gi\fR\->country_code_by_name( \f(CW$hostname\fR );" 4
.IX Item "$code = $gi->country_code_by_name( $hostname );"
Returns the \s-1ISO 3166\s0 country code for a hostname.
.ie n .IP "$code = $gi\->country_code3_by_addr( $ipaddr );" 4
.el .IP "\f(CW$code\fR = \f(CW$gi\fR\->country_code3_by_addr( \f(CW$ipaddr\fR );" 4
.IX Item "$code = $gi->country_code3_by_addr( $ipaddr );"
Returns the 3 letter country code for an \s-1IP\s0 address.
.ie n .IP "$code = $gi\->country_code3_by_name( $hostname );" 4
.el .IP "\f(CW$code\fR = \f(CW$gi\fR\->country_code3_by_name( \f(CW$hostname\fR );" 4
.IX Item "$code = $gi->country_code3_by_name( $hostname );"
Returns the 3 letter country code for a hostname.
.ie n .IP "$name = $gi\->country_name_by_addr( $ipaddr );" 4
.el .IP "\f(CW$name\fR = \f(CW$gi\fR\->country_name_by_addr( \f(CW$ipaddr\fR );" 4
.IX Item "$name = $gi->country_name_by_addr( $ipaddr );"
Returns the full country name for an \s-1IP\s0 address.
.ie n .IP "$name = $gi\->country_name_by_name( $hostname );" 4
.el .IP "\f(CW$name\fR = \f(CW$gi\fR\->country_name_by_name( \f(CW$hostname\fR );" 4
.IX Item "$name = $gi->country_name_by_name( $hostname );"
Returns the full country name for a hostname.
.ie n .IP "$r = $gi\->record_by_addr( $ipaddr );" 4
.el .IP "\f(CW$r\fR = \f(CW$gi\fR\->record_by_addr( \f(CW$ipaddr\fR );" 4
.IX Item "$r = $gi->record_by_addr( $ipaddr );"
Returns a Geo::IP::Record object containing city location for an \s-1IP\s0 address.
.ie n .IP "$r = $gi\->record_by_name( $hostname );" 4
.el .IP "\f(CW$r\fR = \f(CW$gi\fR\->record_by_name( \f(CW$hostname\fR );" 4
.IX Item "$r = $gi->record_by_name( $hostname );"
Returns a Geo::IP::Record object containing city location for a hostname.
.ie n .IP "$org = $gi\->org_by_addr( $ipaddr ); \fBdeprecated\fR use ""name_by_addr"" instead." 4
.el .IP "\f(CW$org\fR = \f(CW$gi\fR\->org_by_addr( \f(CW$ipaddr\fR ); \fBdeprecated\fR use \f(CWname_by_addr\fR instead." 4
.IX Item "$org = $gi->org_by_addr( $ipaddr ); deprecated use name_by_addr instead."
Returns the Organization, \s-1ISP\s0 name or Domain Name for an \s-1IP\s0 address.
.ie n .IP "$org = $gi\->org_by_name( $hostname );  \fBdeprecated\fR use ""name_by_name"" instead." 4
.el .IP "\f(CW$org\fR = \f(CW$gi\fR\->org_by_name( \f(CW$hostname\fR );  \fBdeprecated\fR use \f(CWname_by_name\fR instead." 4
.IX Item "$org = $gi->org_by_name( $hostname ); deprecated use name_by_name instead."
Returns the Organization, \s-1ISP\s0 name or Domain Name for a hostname.
.ie n .IP "$info = $gi\->database_info;" 4
.el .IP "\f(CW$info\fR = \f(CW$gi\fR\->database_info;" 4
.IX Item "$info = $gi->database_info;"
Returns database string, includes version, date, build number and copyright notice.
.ie n .IP "$old_charset = $gi\->set_charset( $charset );" 4
.el .IP "\f(CW$old_charset\fR = \f(CW$gi\fR\->set_charset( \f(CW$charset\fR );" 4
.IX Item "$old_charset = $gi->set_charset( $charset );"
Set the charset for the city name \- defaults to \s-1GEOIP_CHARSET_ISO_8859_1. \s0 To
set \s-1UTF8,\s0 pass \s-1GEOIP_CHARSET_UTF8\s0 to set_charset.
For perl >= 5.008 the utf8 flag is honored.
.ie n .IP "$charset = $gi\->charset;" 4
.el .IP "\f(CW$charset\fR = \f(CW$gi\fR\->charset;" 4
.IX Item "$charset = $gi->charset;"
Gets the currently used charset.
.ie n .IP "( $country, $region ) = $gi\->region_by_addr('24.24.24.24');" 4
.el .IP "( \f(CW$country\fR, \f(CW$region\fR ) = \f(CW$gi\fR\->region_by_addr('24.24.24.24');" 4
.IX Item "( $country, $region ) = $gi->region_by_addr('24.24.24.24');"
Returns a list containing country and region. If region and/or country is
unknown, undef is returned. Sure this works only for region databases.
.ie n .IP "( $country, $region ) = $gi\->region_by_name('www.xyz.com');" 4
.el .IP "( \f(CW$country\fR, \f(CW$region\fR ) = \f(CW$gi\fR\->region_by_name('www.xyz.com');" 4
.IX Item "( $country, $region ) = $gi->region_by_name('www.xyz.com');"
Returns a list containing country and region. If region and/or country is
unknown, undef is returned. Sure this works only for region databases.
.ie n .IP "$netmask = $gi\->last_netmask;" 4
.el .IP "\f(CW$netmask\fR = \f(CW$gi\fR\->last_netmask;" 4
.IX Item "$netmask = $gi->last_netmask;"
Gets netmask of network block from last lookup.
.ie n .IP "$gi\->netmask(12);" 4
.el .IP "\f(CW$gi\fR\->netmask(12);" 4
.IX Item "$gi->netmask(12);"
Sets netmask for the last lookup
.ie n .IP "my ( $from, $to ) = $gi\->range_by_ip('24.24.24.24');" 4
.el .IP "my ( \f(CW$from\fR, \f(CW$to\fR ) = \f(CW$gi\fR\->range_by_ip('24.24.24.24');" 4
.IX Item "my ( $from, $to ) = $gi->range_by_ip('24.24.24.24');"
Returns the start and end of the current network block. The method tries to join several continuous netblocks.
.ie n .IP "$api = $gi\->api or $api = Geo::IP\->api" 4
.el .IP "\f(CW$api\fR = \f(CW$gi\fR\->api or \f(CW$api\fR = Geo::IP\->api" 4
.IX Item "$api = $gi->api or $api = Geo::IP->api"
Returns the currently used \s-1API.\s0
.Sp
.Vb 2
\&  # prints either CAPI or PurePerl
\&  print Geo::IP\->api;
.Ve
.ie n .IP "$continent = $gi\->continent_code_by_country_code('\s-1US\s0');" 4
.el .IP "\f(CW$continent\fR = \f(CW$gi\fR\->continent_code_by_country_code('\s-1US\s0');" 4
.IX Item "$continent = $gi->continent_code_by_country_code('US');"
Returns the continent code by country code.
.ie n .IP "$dbe = $gi\->database_edition" 4
.el .IP "\f(CW$dbe\fR = \f(CW$gi\fR\->database_edition" 4
.IX Item "$dbe = $gi->database_edition"
Returns the database_edition of the currently opened database.
.Sp
.Vb 3
\&  if ( $gi\->database_edition == GEOIP_COUNTRY_EDITION ){
\&    ...
\&  }
.Ve
.ie n .IP "$isp = $gi\->isp_by_addr('24.24.24.24');" 4
.el .IP "\f(CW$isp\fR = \f(CW$gi\fR\->isp_by_addr('24.24.24.24');" 4
.IX Item "$isp = $gi->isp_by_addr('24.24.24.24');"
Returns the isp for 24.24.24.24
.ie n .IP "$isp = $gi\->isp_by_name('www.maxmind.com');" 4
.el .IP "\f(CW$isp\fR = \f(CW$gi\fR\->isp_by_name('www.maxmind.com');" 4
.IX Item "$isp = $gi->isp_by_name('www.maxmind.com');"
Returns the isp for www.something.de
.ie n .IP "my $time_zone = $gi\->time_zone('\s-1US\s0', '\s-1AZ\s0');" 4
.el .IP "my \f(CW$time_zone\fR = \f(CW$gi\fR\->time_zone('\s-1US\s0', '\s-1AZ\s0');" 4
.IX Item "my $time_zone = $gi->time_zone('US', 'AZ');"
Returns the time zone for country/region.
.Sp
.Vb 2
\&  # undef
\&  print  $gi\->time_zone(\*(AqUS\*(Aq, \*(Aq\*(Aq);
\&
\&  # America/Phoenix
\&  print  $gi\->time_zone(\*(AqUS\*(Aq, \*(AqAZ\*(Aq);
\&
\&  # Europe/Berlin
\&  print  $gi\->time_zone(\*(AqDE\*(Aq, \*(Aq00\*(Aq);
\&
\&  # Europe/Berlin
\&  print  $gi\->time_zone(\*(AqDE\*(Aq, \*(Aq\*(Aq);
.Ve
.ie n .IP "$id = $gi\->id_by_addr('24.24.24.24');" 4
.el .IP "\f(CW$id\fR = \f(CW$gi\fR\->id_by_addr('24.24.24.24');" 4
.IX Item "$id = $gi->id_by_addr('24.24.24.24');"
Returns the country_id for 24.24.24.24. The country_id might be useful as array
index. 0 is unknown.
.ie n .IP "$id = $gi\->id_by_name('www.maxmind.com');" 4
.el .IP "\f(CW$id\fR = \f(CW$gi\fR\->id_by_name('www.maxmind.com');" 4
.IX Item "$id = $gi->id_by_name('www.maxmind.com');"
Returns the country_id for www.maxmind.com. The country_id might be useful as array
index. 0 is unknown.
.ie n .IP "$cc = $gi\->country_code3_by_addr_v6('::24.24.24.24');" 4
.el .IP "\f(CW$cc\fR = \f(CW$gi\fR\->country_code3_by_addr_v6('::24.24.24.24');" 4
.IX Item "$cc = $gi->country_code3_by_addr_v6('::24.24.24.24');"
.PD 0
.ie n .IP "$cc = $gi\->country_code3_by_name_v6('ipv6.google.com');" 4
.el .IP "\f(CW$cc\fR = \f(CW$gi\fR\->country_code3_by_name_v6('ipv6.google.com');" 4
.IX Item "$cc = $gi->country_code3_by_name_v6('ipv6.google.com');"
.ie n .IP "$cc = $gi\->country_code_by_addr_v6('2a02:ea0::');" 4
.el .IP "\f(CW$cc\fR = \f(CW$gi\fR\->country_code_by_addr_v6('2a02:ea0::');" 4
.IX Item "$cc = $gi->country_code_by_addr_v6('2a02:ea0::');"
.ie n .IP "$cc = $gi\->country_code_by_ipnum_v6($ipnum);" 4
.el .IP "\f(CW$cc\fR = \f(CW$gi\fR\->country_code_by_ipnum_v6($ipnum);" 4
.IX Item "$cc = $gi->country_code_by_ipnum_v6($ipnum);"
.PD
.Vb 5
\&  use Socket;
\&  use Socket6;
\&  use Geo::IP;
\&  my $g = Geo::IP\->open(\*(Aq/usr/local/share/GeoIP/GeoIPv6.dat\*(Aq) or die;
\&  print $g\->country_code_by_ipnum_v6(inet_pton AF_INET6, \*(Aq::24.24.24.24\*(Aq);
.Ve
.ie n .IP "$cc = $gi\->country_code_by_name_v6('ipv6.google.com');" 4
.el .IP "\f(CW$cc\fR = \f(CW$gi\fR\->country_code_by_name_v6('ipv6.google.com');" 4
.IX Item "$cc = $gi->country_code_by_name_v6('ipv6.google.com');"
.PD 0
.IP "name_by_addr" 4
.IX Item "name_by_addr"
.PD
Returns the Organization, \s-1ISP\s0 name or Domain Name for a \s-1IP\s0 address.
.IP "name_by_addr_v6" 4
.IX Item "name_by_addr_v6"
Returns the Organization, \s-1ISP\s0 name or Domain Name for an IPv6 address.
.IP "name_by_ipnum_v6" 4
.IX Item "name_by_ipnum_v6"
Returns the Organization, \s-1ISP\s0 name or Domain Name for an ipnum.
.IP "name_by_name" 4
.IX Item "name_by_name"
Returns the Organization, \s-1ISP\s0 name or Domain Name for a hostname.
.IP "name_by_name_v6" 4
.IX Item "name_by_name_v6"
Returns the Organization, \s-1ISP\s0 name or Domain Name for a hostname.
.ie n .IP "org_by_addr_v6 \fBdeprecated\fR use ""name_by_addr_v6""" 4
.el .IP "org_by_addr_v6 \fBdeprecated\fR use \f(CWname_by_addr_v6\fR" 4
.IX Item "org_by_addr_v6 deprecated use name_by_addr_v6"
Returns the Organization, \s-1ISP\s0 name or Domain Name for an IPv6 address.
.ie n .IP "org_by_name_v6  \fBdeprecated\fR use ""name_by_name_v6""" 4
.el .IP "org_by_name_v6  \fBdeprecated\fR use \f(CWname_by_name_v6\fR" 4
.IX Item "org_by_name_v6 deprecated use name_by_name_v6"
Returns the Organization, \s-1ISP\s0 name or Domain Name for a hostname.
.IP "teredo" 4
.IX Item "teredo"
Returns the current setting for teredo.
.IP "enable_teredo" 4
.IX Item "enable_teredo"
Enable / disable teredo
.Sp
.Vb 2
\&  $gi\->enable_teredo(1); # enable
\&  $gi\->enable_teredo(0); # disable
.Ve
.IP "lib_version" 4
.IX Item "lib_version"
.Vb 3
\&  if ( $gi\->api eq \*(AqCAPI\*(Aq ){
\&      print $gi\->lib_version;
\&  }
.Ve
.SH "ISSUE TRACKER AND GIT repo"
.IX Header "ISSUE TRACKER AND GIT repo"
Is available from GitHub, see
.PP
https://github.com/maxmind/geoip\-api\-perl
.SH "SEE ALSO"
.IX Header "SEE ALSO"
GeoIP2 \- database reader for the GeoIP2 format.
.SH "SUPPORT"
.IX Header "SUPPORT"
Bugs may be submitted through <https://github.com/maxmind/geoip\-api\-perl/issues>.
.SH "AUTHORS"
.IX Header "AUTHORS"
.IP "\(bu" 4
Dave Rolsky <drolsky@maxmind.com>
.IP "\(bu" 4
Greg Oschwald <goschwald@maxmind.com>
.SH "CONTRIBUTORS"
.IX Header "CONTRIBUTORS"
.IP "\(bu" 4
asb-cpan <asb\-cpan@users.noreply.github.com>
.IP "\(bu" 4
Boris Zentner <bzentner@maxmind.com>
.IP "\(bu" 4
Boris Zentner <bzm@2bz.de>
.IP "\(bu" 4
John \s-1SJ\s0 Anderson <genehack@genehack.org>
.IP "\(bu" 4
Olaf Alders <oalders@maxmind.com>
.IP "\(bu" 4
Philip A. Prindeville <philipp@redfish\-solutions.com>
.IP "\(bu" 4
shawniverson <shawniverson@gmail.com>
.IP "\(bu" 4
Thomas J Mather <tjmather@maxmind.com>
.IP "\(bu" 4
Tina Mueller <TINITA@cpan.org>
.IP "\(bu" 4
Will Storey <will@summercat.com>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
This software is copyright (c) 2002 \- 2017 by MaxMind, Inc.
.PP
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.