Class | GeoIP |
In: |
lib/geoip.rb
|
Parent: | Object |
VERSION | = | "1.1.2" | The GeoIP GEM version number | |
DATA_DIR | = | File.expand_path(File.join(File.dirname(__FILE__),'..','data','geoip')) | The +data/+ directory for geoip | |
CountryCode | = | YAML.load_file(File.join(DATA_DIR,'country_code.yml')) | Ordered list of the ISO3166 2-character country codes, ordered by GeoIP ID | |
CountryCode3 | = | YAML.load_file(File.join(DATA_DIR,'country_code3.yml')) | Ordered list of the ISO3166 3-character country codes, ordered by GeoIP ID | |
CountryName | = | YAML.load_file(File.join(DATA_DIR,'country_name.yml')) | Ordered list of the English names of the countries, ordered by GeoIP ID | |
CountryContinent | = | YAML.load_file(File.join(DATA_DIR,'country_continent.yml')) | Ordered list of the ISO3166 2-character continent code of the countries, ordered by GeoIP ID | |
TimeZone | = | YAML.load_file(File.join(DATA_DIR,'time_zone.yml')) | Hash of the timezone codes mapped to timezone name, per zoneinfo | |
GEOIP_COUNTRY_EDITION | = | 1 | ||
GEOIP_CITY_EDITION_REV1 | = | 2 | ||
GEOIP_REGION_EDITION_REV1 | = | 3 | ||
GEOIP_ISP_EDITION | = | 4 | ||
GEOIP_ORG_EDITION | = | 5 | ||
GEOIP_CITY_EDITION_REV0 | = | 6 | ||
GEOIP_REGION_EDITION_REV0 | = | 7 | ||
GEOIP_PROXY_EDITION | = | 8 | ||
GEOIP_ASNUM_EDITION | = | 9 | ||
GEOIP_NETSPEED_EDITION | = | 10 |
database_type | -> | databaseType |
database_type | [R] | The Edition number that identifies which kind of database you‘ve opened |
Open the GeoIP database and determine the file format version.
filename is a String holding the path to the GeoIP.dat file options is an integer holding caching flags (unimplemented)
Search a ASN GeoIP database for the specified host, returning the AS number and description.
hostname is a String holding the host‘s DNS name or numeric IP address.
Returns the AS number and description.
Source: geolite.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
Search the GeoIP database for the specified host, returning city info.
hostname is a String holding the host‘s DNS name or numeric IP address.
Returns a City object with the fourteen elements:
Search the GeoIP database for the specified host, returning country info.
hostname is a String holding the host‘s DNS name or numeric IP address.
If the database is a City database (normal), return the result that city would return.
Otherwise, return a Country object with the seven elements:
Search a ISP GeoIP database for the specified host, returning the ISP Not all GeoIP databases contain ISP information. Check maxmind.com
hostname is a String holding the host‘s DNS name or numeric IP address.
Returns the ISP name.