Mercurial > prosody-modules
changeset 2892:bf9fc41bf7ad
mod_register_dnsbl: Add support for IPv6 DNSBL
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Feb 2018 22:00:18 +0100 |
parents | 84670bac7348 |
children | d958558e0058 |
files | mod_register_dnsbl/mod_register_dnsbl.lua |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_register_dnsbl/mod_register_dnsbl.lua Fri Feb 23 21:59:28 2018 +0100 +++ b/mod_register_dnsbl/mod_register_dnsbl.lua Fri Feb 23 22:00:18 2018 +0100 @@ -1,6 +1,7 @@ local adns = require "net.adns"; local async = require "util.async"; local inet_pton = require "util.net".pton; +local to_hex = require "util.hex".to; local rbl = module:get_option_string("registration_rbl"); @@ -10,6 +11,8 @@ if #n == 4 then local a,b,c,d = n:byte(1,4); return ("%d.%d.%d.%d.%s"):format(d,c,b,a, suffix); + elseif #n == 16 then + return to_hex(n):reverse():gsub("%x", "%1.") .. suffix; end end