you, sir won 1000 kudos und internets, great work!
i will put this into a production later next week and report back, if
i find issues.
cheers,
mex
2014-11-15 17:27 GMT+01:00 Hamish Forbes <hamish...@gmail.com>:
> Hi All,
>
> I've pulled most of our code out into a separate module:
> https://github.com/hamishforbes/lua-resty-iputils
>
> Pretty basic but it should be enough to implement IPv4 ACLs.
>
> There's probably some optimisation that can be done and theres no support
> for IPv6 ($DAYJOB isn't IPv6 enabled yet so this isn't a priority for us
> either).
> Pull requests more than welcome!
>
> Hamish
>
> On Wednesday, 12 November 2014 15:34:06 UTC, mex wrote:
>>
>> Hi list,
>>
>>
>> i'm looking for a lua-lib for network-calculation. namely i'm looking
>> for a function
>> to check if a given ip is part of a given cidr, without iterating through
>> all
>> possibe ips.
>>
>> if check_ip_in_cidr(ip, cidr) then
>> ...
>> end
>>
>>
>> i found this so far,
>>
>> http://luci.subsignal.org/trac/browser/luci/trunk/libs/core/luasrc/ip.lua?rev=6880
>> but am not quite happy; using nmaps nselib is not a solution either.
>>
>> up to now i'm using
>>
>> geo $cwl {
>> default 0;
>> include conf.d/my_cidrs.txt;
>>
>> }
>>
>> and then i evaluate the VAR from within lua:
>>
>> if ngx.var.cwl == "1" then
>> log("whitelisted")
>> return
>> end
>>
>>
>>
>>
>> thanx in advance,
>>
>> mex.