geoip(3)
π geoip β the Tcl glow-up for IP lookups π
okay so bestie, welcome to geoip(3), manual section 3, straight out of Version 0.2 β¨ this is the Tcl extension that does geographic and organisational lookups of IP addresses and hostnames, and she is lowkey iconic.
β¨ NAME β¨
geoip β a Tcl extension for geographic or organisational lookup of IP addresses and hostnames. that's it, that's the girl π«Ά
πΈ SYNOPSIS πΈ
no cap, here's how you call her:
geoip open [-type TYPE ] [-flags FLAG ]
geoip open [-file PATH ] [-flags FLAG ]
geoip [COMMAND]
geoip [QUERY] arg1
π¦ DESCRIPTION π¦
this Tcl extension literally wraps up most of the GeoIP C API functions and turns them into Tcl commands. so you get to stay in your cozy Tcl era instead of going full C-mode. she ate π
π OPEN OPTIONS π
open takes either a file path plus a set of flags, or a type plus a set of flags. both paths are valid, pick your fighter. supported types and flags live below π
TYPEβ looks under the standard installation share directory, eg/usr/local/share/GeoIP/for a GeoIP database according to type. it just knows where to look π§PATHβ absolute or relative path to the GeoIP database. you tell her exactly where it lives.FLAGβ flags seperated by':', egmemory_cache:memory_check. yes, that spelling is the original's, we keep it fr fr π
π COMMAND π
individual singular commands can be one of:
closeβ close the currently open database. bye bestie, gate closed πͺdb_infoβ get information about the current database.db_editionβ returns edition of opened database.db_availβ test the availability of databases in your system in known locations. e.gdb_avail country_edition. she's doing a vibe check on your databases β
π₯ QUERY π₯
these are the commands that actually query the database. all commands return N/A if a result cannot be found β no drama, just a polite shrug.
also: if none is already open, a command will attempt to open a suitable database on its own. main character energy, she handles it π
countrycommands will open acountry_editiondatabase.regioncommands will open aregion_edition_rev1one.namecommands will open anorg_editionone.- the
record_editionwill open acity_edition_rev1database.
the commands are:
country_code_by_addrβ takes an IP address and returns the ISO-3166-1 Alpha-2 code of the country.country_code3_by_addrβ takes an IP address and returns the ISO-3166-1 Alpha-3 code the country.country_code_by_nameβ takes a hostname and returns the ISO-3166-1 Alpha-2 code the country.country_code3_by_nameβ takes a hostname and returns the ISO-3166-1 Alpha-3 code the country.country_name_by_addrβ takes an IP address and returns the country name.country_name_by_nameβ takes a hostname and returns the country name.name_by_addrβ takes an IP address and returns the organisation name (or ISP/ASnum according to the opened database).name_by_nameβ takes a hostname and returns the organisation name.region_by_addrβ takes an IP address and returns these region attributes as in an associative array:country,region.region_by_nameβ takes a hostname and returns the region attributes.record_by_addrβ 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), andarea(area code).record_by_nameβ takes a hostname and returns the record attributes.
π TYPES π
relevant types of databases are: country_edition, org_edition, isp_edition, city_edition_rev1, region_edition_rev1, geoip_asnum_edition.
and here's the slay part: open -type will accept their unambiguous abbreviations. so you don't have to type the whole thing, she gets the vibe π
π FLAGS π
valid flags are: standard, memory_cache, check_cache, index_cache.
π FILES π
./share/GeoIP.datβ GeoIPcountry_editiondatabase../share/GeoIPOrg.datβ GeoIPorg_editiondatabase../share/GeoIPCity.datβ GeoIPregion_city_rev1database../share/GeoIPRegion.datβ GeoIPregion_edition_rev1database../share/GeoIPASNum.datβ GeoIPasnum_editiondatabase.
π BUGS π
please report to author. (not me, not the group chat β the author. go tell them directly bestie π)
π«Ά AUTHOR π«Ά
Djihed Afifi <djihed@gmail.com>.
π SEE ALSO π
GeoIP C API documentation <www.maxmind.com> β go read the source material, iykyk.
and that's the whole page, periodt. this was geoip(3) from the Tcl extension fam, dated April 2007 β yes she's an elder but she still serves β¨ππ mwah, go do your lookups π¦
π¦ where this page comes from
- ubuntu jammy: tclgeoip 0.2-1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms