Hi Cédric,

On 03/07/2018 07:16 PM, cedric....@netplus.pro wrote:
> I’m trying to use the addMask(masks) function but I’m unable to have it
> work with a table? I didn’t get how to do it…

The syntax of NetmaskGroup:addMasks() was designed to take the kind of
tables returned by the exceed* functions and therefore is indeed not
very intuitive to use in other contexts. The table needs to have
ComboAddress objects as keys and numerical values. For example:

> myNMG = newNMG()
> myNMG:addMasks({[newCA("192.0.2.1")] = 0, [newCA("192.0.2.2")] = 0})
> myNMG:size()
2
> if myNMG:match(newCA("192.0.2.1")) then return 1 else return 0 end
1
> if myNMG:match(newCA("192.0.2.3")) then return 1 else return 0 end
0
>

Best regards,

-- 
Remi Gacogne
PowerDNS.COM BV - https://www.powerdns.com/

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
dnsdist mailing list
dnsdist@mailman.powerdns.com
https://mailman.powerdns.com/mailman/listinfo/dnsdist

Reply via email to