geoip - A Tcl extension for geographic or organisational lookup of IP addresses
geoip open [-type TYPE
geoip open [-file PATH
geoip [COMMAND] geoip [QUERY]arg1
This Tcl extension encapsulates most of GeoIP C API functions into tcl commands.
open 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
Individual 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
Commands 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
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.
Relevant types of databases are:
geoip_asnum_edition. "open -type" will accept their unambiguous abbreviations.