SYNOPSISgeoip open [-type TYPE ] [-flags FLAG ]
geoip open [-file PATH ] [-flags FLAG ]
geoip [QUERY] arg1
DESCRIPTIONThis Tcl extension encapsulates most of GeoIP C API functions into tcl commands.
OPEN OPTIONSopen takes either a file path and a set of flags, or a type and a set of flags. Supported types and flags are described below.
- Looks under the standard installation share directory, eg /usr/local/share/GeoIP/ for a GeoIP database according to type.
- Absolute/relative path to GeoIP database.
- Flags seperated by ':', eg memory_cache:memory_check
COMMANDIndividual singular commands can be one of:
- Close the currently open database.
- Get information about the current database.
- Returns edition of opened database.
- Test the availability of databases in your system in known locations. e.g db_avail country_edition
QUERYCommands that query the database. All commands return N/A if a result cannot be found. If none already open, a command will attempt to open a suitable database. country commands will open a country_edition database. region commands will open a region_edition_rev1 one. name commands will open an org_edition one, and the record_edition will open a city_edition_rev1 database. The commands are:
- Takes an IP address and returns the ISO-3166-1 Alpha-2 code of the country.
- Takes an IP address and returns the ISO-3166-1 Alpha-3 code the country.
- Takes a hostname and returns the ISO-3166-1 Alpha-2 code the country.
- Takes a hostname and returns the ISO-3166-1 Alpha-3 code the country.
- Takes an IP address and returns the country name.
- Takes a hostname and returns the country name.
- Takes an IP address and returns the organisation name (or ISP/ASnum according to the opened database)
- Takes a hostname and returns the organisation name.
- Takes an IP address and returns these region attributes as in an associative array: country, region
- Takes a hostname and returns the region attributes.
- Takes an IP address and returns these record attributes as in an associative array: code, code3, region, country, city, postcode, latitude, longitude, dma(dma code), and area (area code)
- Takes a hostname and returns the record attributes.
TYPESRelevant types of databases are: country_edition, org_edition, isp_edition, city_edition_rev1, region_edition_rev1, geoip_asnum_edition. "open -type" will accept their unambiguous abbreviations.
FLAGSValid flags are: standard, memory_cache, check_cache, index_cache.
- GeoIP country_edition database.
- GeoIP org_edition database.
- GeoIP region_city_rev1 database.
- GeoIP region_edition_rev1 database.
- GeoIP asnum_edition database.