<commit_before>= geoip

http://github.com/cjheath/geoip

== DESCRIPTION:

GeoIP searches a GeoIP database for a given host or IP address, and
returns information about the country where the IP address is allocated,
and the city, ISP and other information, if you have that database version.

== FEATURES/PROBLEMS:

Does not support the new Maxmind v2 database formats.

Includes support for ASN data files, thanks to <NAME>.
This release adds support for timezone names, thanks to <NAME>.

If you have required 'io/extra' and have IO#pread, cross-process file-descriptor sharing is enabled.
Each GeoIP instance keeps the file descriptor open, with a Mutex for thread-safety.
You should consider this if your process will fork without exec, as
{modrails does}[http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing]

== SYNOPSIS:

  require 'geoip'

  # Use the country database:
  c = GeoIP.new('GeoIP.dat').country('www.nokia.com')
  => ["www.nokia.com", "192.168.3.11", 69, "FI", "FIN", "Finland", "EU"]
  c.country_code3
  => "FIN"
  c.to_hash
  => {:country_code3=>"FIN", :country_name=>"Finland", :continent_code=>"EU", :request=>"www.nokia.com", :country_code=>69, :country_code2=>"FI", :ip=>"192.168.3.11"}

Returned values are the requested hostname, the IP address as a dotted quad,
Maxmind's country code, the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3
country code, the ISO3166 country name, and the continent code.

  # Use the city database:
  c = GeoIP.new('GeoLiteCity.dat').city('github.com')
  => ["github.com", "172.16.31.10", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
  >> c.longitude
  => -122.4156
  >> c.timezone
  => "America/Los_Angeles"

  GeoIP.new('GeoCity.dat').city('github.com')
  => ["github.com", "172.16.31.10", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]

  # Use the city ipv6 database:
  GeoIP.new('GeoLiteCityv6.dat').city('::151.38.39.114')
  => ["::151.38.39.114", "::151.38.39.114", "IT", "ITA", "Italy", "EU", "05", "Piacenza", "", 45.016699999999986, 9.666699999999992, nil, nil, "Europe/Rome"]

Returned values are the requested hostname, the IP address as a dotted quad,
the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3 country code, the
ISO3166 country name, the continent code, the region (state or territory) name,
city name, postal_code/zipcode, latitude, longitude, USA DMA code, USA area code,
timezone name.

Result arrays from both city and country have mixed-in accessor methods as appropriate:
request, ip, country_code, country_code2, country_code3, country_name, continent_code,
region_name, city_name, postal_code, latitude, longitude, dma_code, area_code, timezone

  GeoIP.new('GeoIPASNum.dat').asn("www.fsb.ru")
  => ["AS8342", "RTComm.RU Autonomous System"]

For testing or other purposes, you might wish to treat localhost IP addresses as
some other address - an external one. You can do this by assigning the desired
external IP address to the attribute local_ip_alias:

  g = GeoIP.new('GeoIP.dat')
  g.city("127.0.0.1")
  => nil
  g.local_ip_alias = "172.16.17.32"
  g.city("127.0.0.1") 
  #<struct GeoIP::City request="127.0.0.1", ip="172.16.17.32", country_code2="US", country_code3="USA", country_name="United States", continent_code="NA", region_name="CA", city_name="Mountain View", postal_code="94043", latitude=37.41919999999999, longitude=-122.0574, dma_code=807, area_code=650, timezone="America/Los_Angeles", real_region_name="California">

== REQUIREMENTS:

You need one of the free GeoLite country, city or ASN databases, or a subscription database version.
The last known download locations for the GeoLite database versions are
<http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz>,
<http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz>,
<http://geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz>.

This API requires the file to be decompressed for searching. Other versions
of this database are available for purchase which contain more detailed
information, but this information is not returned by this implementation.
See www.maxmind.com for more information.

== INSTALL:

sudo gem install geoip

== LICENSE:

This version Copyright (C) 2005 <NAME>
Derived from the C version, Copyright (C) 2003 MaxMind LLC

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License,
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. This follows the
license applied by Maxmind to their C library, for example in the
version here:
<http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz>.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

<commit_msg>Updated information on GeoLite database downloads and versions<commit_after>= geoip

http://github.com/cjheath/geoip

== DESCRIPTION:

GeoIP searches a GeoIP database for a given host or IP address, and
returns information about the country where the IP address is allocated,
and the city, ISP and other information, if you have that database version.

== FEATURES/PROBLEMS:

Does not support the new Maxmind v2 database formats.

Includes support for ASN data files, thanks to <NAME>.
This release adds support for timezone names, thanks to <NAME>en.

If you have required 'io/extra' and have IO#pread, cross-process file-descriptor sharing is enabled.
Each GeoIP instance keeps the file descriptor open, with a Mutex for thread-safety.
You should consider this if your process will fork without exec, as
{modrails does}[http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing]

== SYNOPSIS:

  require 'geoip'

  # Use the country database:
  c = GeoIP.new('GeoIP.dat').country('www.nokia.com')
  => ["www.nokia.com", "192.168.3.11", 69, "FI", "FIN", "Finland", "EU"]
  c.country_code3
  => "FIN"
  c.to_hash
  => {:country_code3=>"FIN", :country_name=>"Finland", :continent_code=>"EU", :request=>"www.nokia.com", :country_code=>69, :country_code2=>"FI", :ip=>"192.168.3.11"}

Returned values are the requested hostname, the IP address as a dotted quad,
Maxmind's country code, the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3
country code, the ISO3166 country name, and the continent code.

  # Use the city database:
  c = GeoIP.new('GeoLiteCity.dat').city('github.com')
  => ["github.com", "172.16.31.10", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]
  >> c.longitude
  => -122.4156
  >> c.timezone
  => "America/Los_Angeles"

  GeoIP.new('GeoCity.dat').city('github.com')
  => ["github.com", "172.16.31.10", "US", "USA", "United States", "NA", "CA", "San Francisco", "94110", 37.7484, -122.4156, 807, 415, "America/Los_Angeles"]

  # Use the city ipv6 database:
  GeoIP.new('GeoLiteCityv6.dat').city('::151.38.39.114')
  => ["::151.38.39.114", "::151.38.39.114", "IT", "ITA", "Italy", "EU", "05", "Piacenza", "", 45.016699999999986, 9.666699999999992, nil, nil, "Europe/Rome"]

Returned values are the requested hostname, the IP address as a dotted quad,
the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3 country code, the
ISO3166 country name, the continent code, the region (state or territory) name,
city name, postal_code/zipcode, latitude, longitude, USA DMA code, USA area code,
timezone name.

Result arrays from both city and country have mixed-in accessor methods as appropriate:
request, ip, country_code, country_code2, country_code3, country_name, continent_code,
region_name, city_name, postal_code, latitude, longitude, dma_code, area_code, timezone

  GeoIP.new('GeoIPASNum.dat').asn("www.fsb.ru")
  => ["AS8342", "RTComm.RU Autonomous System"]

For testing or other purposes, you might wish to treat localhost IP addresses as
some other address - an external one. You can do this by assigning the desired
external IP address to the attribute local_ip_alias:

  g = GeoIP.new('GeoIP.dat')
  g.city("127.0.0.1")
  => nil
  g.local_ip_alias = "172.16.17.32"
  g.city("127.0.0.1") 
  #<struct GeoIP::City request="127.0.0.1", ip="172.16.17.32", country_code2="US", country_code3="USA", country_name="United States", continent_code="NA", region_name="CA", city_name="Mountain View", postal_code="94043", latitude=37.41919999999999, longitude=-122.0574, dma_code=807, area_code=650, timezone="America/Los_Angeles", real_region_name="California">

== REQUIREMENTS:

You need one of the free GeoLite2 country, city or ASN binary databases, or a subscription database version.
Maxmind have stopped supplying databases in the original GeoLite format - only v2 is currently available.
The download location for the GeoLite databases is <https://dev.maxmind.com/geoip/geoip2/geolite2/>.

This API requires the gzipped binary file to be decompressed for searching.
Other versions of this database are available for purchase which contain more
detailed information, but not all this information is returned by this implementation.
See www.maxmind.com for more information.

== INSTALL:

sudo gem install geoip

== LICENSE:

This version Copyright (C) 2005 <NAME>
Derived from the C version, Copyright (C) 2003 MaxMind LLC

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License,
as published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version. This follows the
license applied by Maxmind to their C library, for example in the
version here:
<http://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz>.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA


{'fraction_non_alphanumeric': 0.11725293132328309, 'fraction_numerical': 0.05713753954959985, 'mean_word_length': 4.921212121212121, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 59, 'https://': 1, 'lorem ipsum': 0, 'www.': 14, 'xml': 0}, 'pii_count': 24, 'substrings_counts': 6, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6735345', 'n_tokens_mistral': 3867, 'n_tokens_neox': 3386, 'n_words': 1223}