lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mon, Nov 22, 2010 at 10:53:47PM +0100, Marcin Jurczuk wrote:

> I'm writing some auth plugin that will have to check if given
> remote-ip belongs to specific network.
> Is there some tool that have similar functions to ipcalc tool ?
> Something similar to:
> =check_ip("","")
> true
> =check_ip("","")
> false
> Otherwise I have to write my own using bitlib module ..

I've written a small module that uses Mike Pall's bit library and
Roberto's LPEG to parse IP addresses and expressions.  It can cope with
things like:

etc, parsing them into a single value which can then be easily converted
to other notations, or used to see if another address is within the
range specified.

It is as yet unfinished; anybody wanting a copy contact should me off list.