NAME

VPNDetection::Result - what a lookup answers

SYNOPSIS

my $result = $client->lookup('45.83.91.1');

$result->ip;                    # '45.83.91.1'
$result->is_vpn;                # 1
$result->vpn->{provider};       # 'mullvad'
$result->location->{country};   # the ISO 3166 country code
$result->asn->{name};           # who runs the announcing network
$result->hostname;              # the reverse DNS name, '' where it has none

$result->is_bot;                # 1 when an automated client uses the address
$result->bot->{provider_name};  # whose bot, on a paid plan
$result->is_hosting;            # 1, 0, or undef when your plan omits it
$result->is_hosting // 0;       # read an absent field as false
$result->has('is_hosting');     # 1 if your plan carries it at all

ABSENT IS NOT FALSE

An absent field is one your plan does not include. It never means "we checked and found nothing", so undef and 0 are genuinely different answers.

This is the one place Perl makes it easy to get wrong, because undef, 0, '' and a missing hash key are all false:

if ($result->is_hosting) { ... }        # WRONG: absent and false look alike

if (($result->is_hosting // 0)) { ... } # right: absent reads as false
if ($result->has('is_hosting')) { ... } # right: asks whether it was served

// (defined-or) is the reader for "treat absent as false", and has is the reader for "was this served at all". A result is also a plain hash reference, so exists $result->{is_hosting} is has spelled out and defined $result->{is_hosting} is the same test one level down.

A detail object that is present but empty ({}) means the flag above it is false. A populated one always carries every one of its keys.

METHODS

ip, is_vpn, is_bogon

Always present. is_bogon is 1 for reserved space (private, loopback, documentation and the like), which this module answers locally without a request; a served answer carries the API's own is_bogon, which this reads.

is_hosting, is_relay, is_tor, is_cdn, is_resproxy, is_dcproxy, is_mobproxy, is_pubproxy

The tier-gated flags: 1, 0, or undef when your plan omits the field. On Unlimited, the free plan, with a key or without one, is_tor and is_relay come back beside is_vpn; every paid plan answers every flag. is_pubproxy is whether a public proxy, one anyone can connect through, listens on the address or sends its traffic out from it.

is_bot

On every answer, with or without a key: 1 when an automated client uses the address, such as a search engine's or an AI company's crawler, an uptime monitor, an internet scanner or a webhook sender, 0 when none does, and undef on an answer that does not carry it.

bot

The detail behind is_bot, on a paid plan's answers, or undef when your plan omits it: a plain hash reference, {} when is_bot is false. It carries provider and provider_name (the bot's operator, empty where none is known), agents (an array reference of the bots the address serves, as their user agents name them, in the order served), categories (an array reference of what those bots do), verified (whether the operator vouches for the address), identity, verified_by, confidence, first_seen and last_seen.

is_anycast, is_carrier, is_satellite, is_ssh, is_smtp, is_web, is_dns_resolver, is_bittorrent

is_anycast is on every answer, with or without a key: whether the address is announced from many places at once, as a public DNS resolver's or a CDN's edge is. The rest are on a paid plan's answers: whether the address is a mobile carrier's or a satellite operator's, and whether an SSH server, a mail server, a web server, an open DNS resolver or a BitTorrent client answered on it. Each is 1, 0, or undef when your plan omits it.

vpn, hosting, relay, tor, cdn, resproxy, dcproxy, mobproxy, pubproxy

The detail objects, as plain hash references, or undef when your plan omits them. vpn carries provider, provider_name, last_seen and confidence; its method is deprecated, since no plan is answered with it from 2026-10-20. pubproxy carries entry, exit, protocols (an array reference), num_ports, num_proxies, last_seen and last_usable. num_ports is 0 when the address is only an exit and num_proxies 0 when it is only an entry; last_usable is an empty string when no request through a proxy on the address was answered.

carrier, satellite, ssh, smtp, web, dns_resolver, bittorrent

The detail behind each of those flags, on a paid plan's answers, or undef when your plan omits it. Each is a plain hash reference, {} when its flag is false, except web, an array reference with one hash per port that answered, [] when is_web is false. carrier carries name, mcc, mnc, country and confidence; satellite provider, provider_name, orbit, segment, country, asn and confidence; ssh port, banner, host_key_fp, session_ok, first_seen and last_seen; smtp port, banner, session_ok, first_seen and last_seen; each row of web port, tls_ok, session_ok, status_code, server, location, title, cert_subject_cn, cert_subject_o, cert_issuer_dn, cert_browser_trusted, tls_version, first_seen and last_seen; dns_resolver port, recursion_available, rcode, answer_correct, first_seen and last_seen; bittorrent verified, id_matches_ip, first_seen, last_seen, last_reachable, days_seen, num_ports, peak_num_ports, indexer and clients (an array reference).

location, asn

Where the address is and the AS announcing it, as plain hash references, on every answer, with or without a key. location carries continent, continent_name, country, country_name, timezone, currency_code, currency_name, currency_symbol, flag_emoji and flag_unicode; asn carries asn, name, domain, type, prefix, country and rpki_status. Every key is present whenever the object is: an empty string, and asn 0, where nothing is known. A paid plan's location also carries region, region_code, city, postal_code, latitude, longitude, accuracy_radius, geoname_id, dma_code and last_changed, which are absent on a plan without them.

hostname

The name the address's reverse DNS record points to, on every answer, with or without a key: an empty string where it has none.

company, abuse

On a paid plan's answers, as plain hash references, or undef when your plan omits them. company is who uses the address: name, domain, type and country. abuse is where to report abuse from it: email, name, phone, address, country, network, validated and unvalidated_since. Every key is present whenever the object is: empty strings where no record covers the address.

user_agent

What the user agent sent with the lookup names, and whether the address bears it out, as a plain hash reference, or undef on an answer that does not carry it: one to a lookup that sent no user_agent, one without every field, and a bogon's, which is answered locally. It carries agent (the agent the user agent names, such as Googlebot or Chrome, Unknown where it names none), kind (browser, inapp, automation, bot, ai-bot, http-client or unknown) and verdict: verified when the agent's operator vouches for the address as it, spoofed when the operator of a bot that publishes its addresses does not vouch for this one, unverifiable for a bot nothing can confirm, and not_bot for a browser, an app or a script.

my $r = $client->lookup($ip, user_agent => $request->headers->user_agent);
my $verdict = ($r->user_agent // {})->{verdict} // '';
deny() if $verdict eq 'spoofed';

trial_expired

On answers to a key on the free plan only: 0 while its organization's trial of every field lasts, 1 once the answer has Unlimited's, and undef on any other answer.

cap_reached

On answers to a key on a paid plan only: 0 while the answer has every field, 1 once its organization's overage cap is reached and the answer has Unlimited's, and undef on any other answer. Lookups answered past the cap are not billed.

has($field)

Whether your plan carries $field. Croaks on a name that is not a field.

fields

The field names this answer carried, in wire order.

raw

The decoded response body, untouched. Treat it, and the result itself, as read only: the cache hands the same object to every later caller of an address.