{"id":13484081,"url":"https://github.com/cjheath/geoip","last_synced_at":"2025-05-15T00:09:54.044Z","repository":{"id":576910,"uuid":"209379","full_name":"cjheath/geoip","owner":"cjheath","description":"The Ruby gem for querying Maxmind.com's GeoIP database, which returns the geographic location of a server given its IP address","archived":false,"fork":false,"pushed_at":"2019-04-28T02:27:21.000Z","size":226,"stargazers_count":717,"open_issues_count":9,"forks_count":83,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-05-14T20:51:05.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://geoip.rubyforge.org/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cjheath.png","metadata":{"files":{"readme":"README.rdoc","changelog":"History.rdoc","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-05-25T05:29:18.000Z","updated_at":"2025-05-14T08:05:15.000Z","dependencies_parsed_at":"2022-07-05T01:01:28.818Z","dependency_job_id":null,"html_url":"https://github.com/cjheath/geoip","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjheath%2Fgeoip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjheath%2Fgeoip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjheath%2Fgeoip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cjheath%2Fgeoip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cjheath","download_url":"https://codeload.github.com/cjheath/geoip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249206,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:19.132Z","updated_at":"2025-05-15T00:09:49.006Z","avatar_url":"https://github.com/cjheath.png","language":"Ruby","funding_links":[],"categories":["Geolocation"],"sub_categories":[],"readme":"= geoip\n\nhttp://github.com/cjheath/geoip\n\n== DESCRIPTION:\n\nGeoIP searches a GeoIP database for a given host or IP address, and\nreturns information about the country where the IP address is allocated,\nand the city, ISP and other information, if you have that database version.\n\n== FEATURES/PROBLEMS:\n\nDoes not support the new Maxmind v2 database formats.\n\nIncludes support for ASN data files, thanks to Roland Matiz.\nThis release adds support for timezone names, thanks to Tonni Aagesen.\n\nIf you have required 'io/extra' and have IO#pread, cross-process file-descriptor sharing is enabled.\nEach GeoIP instance keeps the file descriptor open, with a Mutex for thread-safety.\nYou should consider this if your process will fork without exec, as\n{modrails does}[http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing]\n\n== SYNOPSIS:\n\n  require 'geoip'\n\n  # Use the country database:\n  c = GeoIP.new('GeoIP.dat').country('www.nokia.com')\n  =\u003e [\"www.nokia.com\", \"147.243.3.83\", 69, \"FI\", \"FIN\", \"Finland\", \"EU\"]\n  c.country_code3\n  =\u003e \"FIN\"\n  c.to_hash\n  =\u003e {:country_code3=\u003e\"FIN\", :country_name=\u003e\"Finland\", :continent_code=\u003e\"EU\", :request=\u003e\"www.nokia.com\", :country_code=\u003e69, :country_code2=\u003e\"FI\", :ip=\u003e\"147.243.3.83\"}\n\nReturned values are the requested hostname, the IP address as a dotted quad,\nMaxmind's country code, the ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3\ncountry code, the ISO3166 country name, and the continent code.\n\n  # Use the city database:\n  c = GeoIP.new('GeoLiteCity.dat').city('github.com')\n  =\u003e [\"github.com\", \"207.97.227.239\", \"US\", \"USA\", \"United States\", \"NA\", \"CA\", \"San Francisco\", \"94110\", 37.7484, -122.4156, 807, 415, \"America/Los_Angeles\"]\n  \u003e\u003e c.longitude\n  =\u003e -122.4156\n  \u003e\u003e c.timezone\n  =\u003e \"America/Los_Angeles\"\n\n  GeoIP.new('GeoCity.dat').city('github.com')\n  =\u003e [\"github.com\", \"207.97.227.239\", \"US\", \"USA\", \"United States\", \"NA\", \"CA\", \"San Francisco\", \"94110\", 37.7484, -122.4156, 807, 415, \"America/Los_Angeles\"]\n\n  # Use the city ipv6 database:\n  GeoIP.new('GeoLiteCityv6.dat').city('::151.38.39.114')\n  =\u003e [\"::151.38.39.114\", \"::151.38.39.114\", \"IT\", \"ITA\", \"Italy\", \"EU\", \"05\", \"Piacenza\", \"\", 45.016699999999986, 9.666699999999992, nil, nil, \"Europe/Rome\"]\n\nReturned values are the requested hostname, the IP address as a dotted quad,\nthe ISO3166-1 alpha-2 country code, the ISO3166-2 alpha-3 country code, the\nISO3166 country name, the continent code, the region (state or territory) name,\ncity name, postal_code/zipcode, latitude, longitude, USA DMA code, USA area code,\ntimezone name.\n\nResult arrays from both city and country have mixed-in accessor methods as appropriate:\nrequest, ip, country_code, country_code2, country_code3, country_name, continent_code,\nregion_name, city_name, postal_code, latitude, longitude, dma_code, area_code, timezone\n\n  GeoIP.new('GeoIPASNum.dat').asn(\"www.fsb.ru\")\n  =\u003e [\"AS8342\", \"RTComm.RU Autonomous System\"]\n\nFor testing or other purposes, you might wish to treat localhost IP addresses as\nsome other address - an external one. You can do this by assigning the desired\nexternal IP address to the attribute local_ip_alias:\n\n  g = GeoIP.new('GeoIP.dat')\n  g.city(\"127.0.0.1\")\n  =\u003e nil\n  g.local_ip_alias = \"173.194.112.35\"\n  g.city(\"127.0.0.1\") \n  #\u003cstruct GeoIP::City request=\"127.0.0.1\", ip=\"173.194.112.35\", 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\"\u003e\n\n== REQUIREMENTS:\n\nYou need one of the free GeoLite country, city or ASN binary databases, or a subscription database version.\nMaxmind have unfortunately stopped updating databases in the original GeoLite format - only v2 is currently available, and the CSV form.\nThere is no available compiler from CSV to the legacy database format, so this gem has started to go stale and needs a path forwards. Any volunteers?\nThe download location for the GeoLite2 databases is \u003chttps://dev.maxmind.com/geoip/geoip2/geolite2/\u003e.\n\nThis API requires a gzipped binary file to be decompressed for searching.\nOther versions of this database are available for purchase which contain more\ndetailed information, but not all this information is returned by this implementation.\nSee www.maxmind.com for more information.\n\n== INSTALL:\n\nsudo gem install geoip\n\n== LICENSE:\n\nThis version Copyright (C) 2005 Clifford Heath\nDerived from the C version, Copyright (C) 2003 MaxMind LLC\n\nThis library is free software; you can redistribute it and/or\nmodify it under the terms of the GNU Lesser General Public License,\nas published by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version. This follows the\nlicense applied by Maxmind to their C library, for example in the\nversion here:\n\u003chttp://www.maxmind.com/download/geoip/api/c/GeoIP-1.4.2.tar.gz\u003e.\n\nThis library is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this library; if not, write to the Free Software\nFoundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjheath%2Fgeoip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcjheath%2Fgeoip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcjheath%2Fgeoip/lists"}