From: Edward Dore <5480052+spheron1@users.noreply.github.com> Date: Sun, 14 Jan 2024 11:22:29 +0000 (+0000) Subject: Fix country()/countryCode() mixup in example Lua Record X-Git-Tag: dnsdist-1.9.0-rc1~40^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=784b67fb38895edd6a96da612c8e6f57801877dc;p=thirdparty%2Fpdns.git Fix country()/countryCode() mixup in example Lua Record The country() function returns true if the country code for the query source IP address matches the country code passed to the function. The countryCode() function doesn't take any arguments and just returns the country code of the query source IP address. For this example, we're checking if the country for the query source IP address is "US" and expecting a true/false response, so country() is the correct function to use. Alternatively, this would be something like "if countryCode() == 'US' then return...". --- diff --git a/docs/lua-records/index.rst b/docs/lua-records/index.rst index 4028feb65c..74367a21e8 100644 --- a/docs/lua-records/index.rst +++ b/docs/lua-records/index.rst @@ -78,7 +78,7 @@ This will pick from the viable IP addresses the one deemed closest to the user. LUA records can also contain more complex code, for example:: - www IN LUA A ";if countryCode('US') then return {'192.0.2.1','192.0.2.2','198.51.100.1'} else return '192.0.2.2' end" + www IN LUA A ";if country('US') then return {'192.0.2.1','192.0.2.2','198.51.100.1'} else return '192.0.2.2' end" As you can see you can return both single string value or array of strings.