| 1 |
.\" Generated by Mmark Markdown Processor - mmark.miek.nl |
| 2 |
.TH "GEOIP" 7 "August 2026" "atomdns handlers" "atomdns authors" |
| 3 |
|
| 4 |
.SH "NAME" |
| 5 |
.PP |
| 6 |
\fIgeoip\fP \- add geographical location data |
| 7 |
|
| 8 |
.SH "DESCRIPTION" |
| 9 |
.PP |
| 10 |
The \fIgeoip\fP handler adds geographical location data associated with the client IP. You can install a database |
| 11 |
on Debian systems with \fB\fCapt-get install geoip-database\fR, or see https://mailfud.org/geoip\-legacy/. |
| 12 |
|
| 13 |
.PP |
| 14 |
There is no automatic reloading of the databases under the assumption they will not change \fIthat\fP often. |
| 15 |
|
| 16 |
.PP |
| 17 |
If an IP address does not have associated geographical location data, nothing is added to the context. If the |
| 18 |
\fIecs\fP handler is active and has added data to the context the address from there is used instead of the |
| 19 |
sources address of the query. |
| 20 |
|
| 21 |
.SH "SYNTAX" |
| 22 |
.PP |
| 23 |
.RS |
| 24 |
|
| 25 |
.nf |
| 26 |
geoip { |
| 27 |
city DBFILE4 [DBFILE6] |
| 28 |
asn DBFILE4 [DBFILE6] |
| 29 |
} |
| 30 |
|
| 31 |
.fi |
| 32 |
.RE |
| 33 |
|
| 34 |
.IP \(bu 4 |
| 35 |
\fB\fCcity\fR and \fB\fCasn\fR define the database files that should be used for country, city or AS number |
| 36 |
lookups. If the path is relative the path from \fB\fCroot\fR will be prepended. At least one database must be |
| 37 |
loaded. |
| 38 |
|
| 39 |
|
| 40 |
.SH "CONTEXT" |
| 41 |
.PP |
| 42 |
The following values will be stored in the context of a request and can be used by other handlers. |
| 43 |
|
| 44 |
.PP |
| 45 |
The continent codes are: \fB\fCAF\fR: Africa, \fB\fCAN\fR: Antarctica, \fB\fCAS\fR: Asia, \fB\fCEU\fR: Europe, \fB\fCNA\fR: North America, |
| 46 |
\fB\fCOC\fR: Oceania, \fB\fCSA\fR: South America. |
| 47 |
|
| 48 |
.RS |
| 49 |
.TS |
| 50 |
allbox; |
| 51 |
l l l l |
| 52 |
l l l l |
| 53 |
l l l l |
| 54 |
l l l l |
| 55 |
l l l l |
| 56 |
l l l l |
| 57 |
l l l l |
| 58 |
l l l l |
| 59 |
l l l l |
| 60 |
l l l l |
| 61 |
l l l l |
| 62 |
. |
| 63 |
\fBKey\fP\fB Type\fP\fB Example\fP\fB Description\fP |
| 64 |
\fB\fCgeoip/city\fR \fB\fCstring\fR Cambridge The city name in English language. |
| 65 |
\fB\fCgeoip/city/region\fR \fB\fC[]string\fR ENG TWH Regional ISO 3166\-2 codes. |
| 66 |
\fB\fCgeoip/country\fR \fB\fCstring\fR GB Country ISO 3166\-1 code. |
| 67 |
\fB\fCgeoip/country/eu\fR \fB\fCbool\fR false Country is EU member. |
| 68 |
\fB\fCgeoip/continent\fR \fB\fCstring\fR EU Continent code. |
| 69 |
\fB\fCgeoip/latitude\fR \fB\fCfloat64\fR 52.2242 Base 10, max available precision. |
| 70 |
\fB\fCgeoip/longitude\fR \fB\fCfloat64\fR 0.1315 Base 10, max available precision. |
| 71 |
\fB\fCgeoip/timezone\fR \fB\fCstring\fR Europe/London The time zone. |
| 72 |
\fB\fCgeoip/asn\fR \fB\fCint\fR 37 The AS number. |
| 73 |
\fB\fCgeoip/asn/organization\fR \fB\fCstring\fR Example Org The AS organization. |
| 74 |
.TE |
| 75 |
.RE |
| 76 |
|
| 77 |
|
| 78 |
.SH "EXAMPLE" |
| 79 |
.PP |
| 80 |
Here we add location data to the request's context, so that \fItemplate\fP can use it in the template creation. |
| 81 |
|
| 82 |
.PP |
| 83 |
.RS |
| 84 |
|
| 85 |
.nf |
| 86 |
example.org. { |
| 87 |
geoip { |
| 88 |
city testdata/GeoIPCity.dat |
| 89 |
} |
| 90 |
|
| 91 |
template .* { |
| 92 |
mytemplate.go.tmpl |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
.fi |
| 97 |
.RE |
| 98 |
|
| 99 |
.SH "SEE ALSO" |
| 100 |
.PP |
| 101 |
atomdns\-ecs(7). |