From 4f479d3c00837379aba54808aadd7911a8768acd Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Fri, 23 Jan 2026 17:35:53 +0100 Subject: [PATCH] Add documentation for Core and Plus bundles and resproxy --- README.md | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f827f96..d6ded11 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ The returned details are slightly different from the Core API. use Geo::IPinfoLite; $access_token = '123456789abc'; -$ipinfo = Geo::IPinfo->new($access_token); +$ipinfo = Geo::IPinfoLite->new($access_token); $ip_address = '216.239.36.21'; $details = $ipinfo->info($ip_address); @@ -176,6 +176,58 @@ $country_code = $details->country_code; # US $country = $details->country; # United States ``` +### Core API + +The library also supports the [Core API](https://ipinfo.io/developers/data-types#core-data), which provides city-level geolocation with nested geo and AS objects. Authentication with your token is required. + +```perl +use Geo::IPinfoCore; + +$access_token = '123456789abc'; +$ipinfo = Geo::IPinfoCore->new($access_token); + +$details = $ipinfo->info('8.8.8.8'); +$ip = $details->ip; # 8.8.8.8 +$city = $details->geo->{city}; # Mountain View +$country = $details->geo->{country}; # United States +$asn = $details->as->{asn}; # AS15169 +$as_name = $details->as->{name}; # Google LLC +``` + +### Plus API + +The library also supports the [Plus API](https://ipinfo.io/developers/data-types#plus-data), which provides enhanced data including mobile carrier info and privacy detection. Authentication with your token is required. + +```perl +use Geo::IPinfoPlus; + +$access_token = '123456789abc'; +$ipinfo = Geo::IPinfoPlus->new($access_token); + +$details = $ipinfo->info('8.8.8.8'); +$ip = $details->ip; # 8.8.8.8 +$city = $details->geo->{city}; # Mountain View +$mobile = $details->mobile; # mobile carrier info +$is_proxy = $details->anonymous->{is_proxy}; # false +``` + +### Residential Proxy API + +The library also supports the [Residential Proxy API](https://ipinfo.io/developers/residential-proxy-api), which allows you to check if an IP address is a residential proxy. Authentication with your token is required. + +```perl +use Geo::IPinfo; + +$access_token = '123456789abc'; +$ipinfo = Geo::IPinfo->new($access_token); + +$resproxy = $ipinfo->get_resproxy('175.107.211.204'); +$ip = $resproxy->{ip}; # 175.107.211.204 +$last_seen = $resproxy->{last_seen}; # 2025-01-20 +$percent_days_seen = $resproxy->{percent_days_seen}; # 0.85 +$service = $resproxy->{service}; # Bright Data +``` + #### Caching In-memory caching of `Details` data is provided by default via the [Cache::LRU](https://metacpan.org/pod/Cache::LRU) package. This uses an LRU (least recently used) cache with a TTL (time to live) by default. This means that values will be cached for the specified duration; if the cache's max size is reached, cache values will be invalidated as necessary, starting with the oldest cached value.