NAME

Geo::Location::IP::Record::Traits - Various details about an IP address

VERSION

version 0.002

SYNOPSIS

use Geo::Location::IP::Database::Reader;
my $reader = Geo::Location::IP::Database::Reader->new(
  file => '/path/to/City.mmdb',
);
eval {
  my $city_model = $reader->city(ip => '1.2.3.4');
  my $traits     = $city_model->traits;
};

DESCRIPTION

This class contains various details about an IP address.

All fields may be undefined.

SUBROUTINES/METHODS

new

my $traits = Geo::Location::IP::Record::Traits->new(
  autonomous_system_number       => 12345,
  autonomous_system_organization => 'Acme Corporation',
  connection_type                => 'Cellular',
  domain                         => 'example.com',
  ip_address                     => $ip_address,
  is_anonymous                   => 0,
  is_anonymous_proxy             => 0,
  is_anonymous_vpn               => 0,
  is_anycast                     => 0,
  is_hosting_provider            => 0,
  is_legitimate_proxy            => 0,
  is_public_proxy                => 0,
  is_residential_proxy           => 0,
  is_satellite_provider          => 0,
  is_tor_exit_node               => 0,
  isp                            => 'Acme Telecom',
  mobile_country_code            => '001',
  mobile_network_code            => '01',
  organization                   => 'Acme Mobile',
  static_ip_score                => 0.0,
  user_count                     => 123,
  user_type                      => 'cellular',
);

Creates a new traits record.

autonomous_system_number

my $as_number = $traits->autonomous_system_number;

Returns the Autonomous System number associated with the IP address the data is for.

autonomous_system_organization

my $as_organization = $traits->autonomous_system_organization;

Returns the name of the organization associated with the Autonomous System number.

connection_type

my $connection_type = $traits->connection_type;

Returns the connection type as a string. Common types are:

  • Dialup

  • Cable/DSL

  • Corporate

  • Cellular

  • Satellite

domain

my $domain = $traits->domain;

Returns the second-level domain associated with the IP address.

ip_address

my $ip_address = $traits->ip_address;

Returns the IP address the data is for as a Geo::Location::IP::Address object.

is_anonymous

my $is_anonymous = $traits->is_anonymous;

Returns true if the IP address belongs to any sort of anonymous network.

is_anonymous_proxy

my $is_anonymous_proxy = $traits->is_anonymous_proxy;

Returns true if the IP address belongs to an anonymous proxy server. This field is deprecated.

is_anonymous_vpn

my $is_anonymous_vpn = $traits->is_anonymous_vpn;

Returns true if the IP address is known to belong to an anonymous VPN provider.

is_anycast

my $is_anycast = $traits->is_anycast;

Returns true if the IP address belongs to an anycast network.

is_hosting_provider

my $is_hosting_provider = $traits->is_hosting_provider;

Returns true if the IP address belongs to a hosting provider.

is_legitimate_proxy

my $is_legitimate_proxy = $traits->is_legitimate_proxy;

Returns true if the IP address is believed to be a legitimate proxy, such as an internal VPN used by a corporation.

is_public_proxy

my $is_public_proxy = $traits->is_public_proxy;

Returns true if the IP address belongs to a public proxy.

is_residential_proxy

my $is_residential_proxy = $traits->is_residential_proxy;

Returns true if the IP address is on a suspected anonymizing network and belongs to a residential ISP.

is_satellite_provider

my $is_satellite_provider = $traits->is_satellite_provider;

Returns true if the IP address is from a satellite provider that provides service to multiple countries. This field is deprecated.

is_tor_exit_node

my $is_tor_exit_node = $traits->is_tor_exit_node;

Returns true if the IP address is a Tor exit node.

isp

my $isp = $traits->isp;

Returns the name of the Internet Service Provider associated with the IP address.

mobile_country_code

my $mcc = $traits->mobile_country_code;

Returns the mobile country code as a string.

mobile_network_code

my $mnc = $traits->mobile_network_code;

Returns the mobile network code as a string.

organization

my $organization = $traits->organization;

Returns the name of the organization associated with the IP address.

static_ip_score

my $static_ip_score = $traits->static_ip_score;

Indicates how static or dynamic an IP address is. The value ranges from 0.0 to 99.99 with higher values meaning a greater static association.

user_count

my $user_count = $traits->user_count;

Returns the estimated number of users sharing the IP/network during the past 24 hours.

user_type

my $user_type = $traits->user_type;

Returns the user type associated with the IP address as a string. Common values are:

  • business

  • cafe

  • cellular

  • college

  • consumer_privacy_network

  • content_delivery_network

  • dialup

  • government

  • hosting

  • library

  • military

  • residential

  • router

  • school

  • search_engine_spider

  • traveler

DIAGNOSTICS

None.

CONFIGURATION AND ENVIRONMENT

None.

DEPENDENCIES

None.

INCOMPATIBILITIES

None.

BUGS AND LIMITATIONS

None known.

AUTHOR

Andreas Vögele <voegelas@cpan.org>

LICENSE AND COPYRIGHT

Copyright (C) 2025 Andreas Vögele

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