From 84a07c746362e1542090e3807f6661f3aad5d489 Mon Sep 17 00:00:00 2001 From: Bozhan Liang Date: Sat, 14 Dec 2024 10:57:43 +0800 Subject: [PATCH] Add documentation for geoiplookup and GeoIPQueryAttribute Closes #8597 --- docs/lua-records/functions.rst | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/lua-records/functions.rst b/docs/lua-records/functions.rst index 45af5dde9a4f..a5fdeddd432a 100644 --- a/docs/lua-records/functions.rst +++ b/docs/lua-records/functions.rst @@ -448,6 +448,35 @@ Reverse DNS functions Helper functions ~~~~~~~~~~~~~~~~ +.. function:: geoiplookup(address, attr) + + Retrieve specific attributes related to an IP address. + + :param string address: The IP address to lookup. + :param int attr: The attribute identifier for the lookup. + + You can use the following constants as the attribute: + + - `GeoIPQueryAttribute.ASn` + - `GeoIPQueryAttribute.City` + - `GeoIPQueryAttribute.Continent` + - `GeoIPQueryAttribute.Country` + - `GeoIPQueryAttribute.Country2` + - `GeoIPQueryAttribute.Name` + - `GeoIPQueryAttribute.Region` + - `GeoIPQueryAttribute.Location` + + Example:: + + asn.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.ASn)" ; 1 + city.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.City)" ; auckland + continent.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Continent)" ; oc + country.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Country)" ; nz + country2.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Country2)" ; nz + name.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Name)" ; lvlt-1 + region.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Region)" ; auk + location.example.com IN LUA TXT "geoiplookup(bestwho:toString(), GeoIPQueryAttribute.Location)" ; -36.000000 174.000000 + .. function:: asnum(number) asnum(numbers)