Check if IP is within range

598 views
Skip to first unread message

Kevin Whitman

unread,
May 24, 2012, 4:47:15 AM5/24/12
to nod...@googlegroups.com
Not sure where's the best place is to ask. Does anyone know of a function or module that will check if a IP address is within a IPv4 range, also with IPv6 support. Say it would get a list like 

var IPV4 = ['204.93.240.0/24', '204.93.177.0/24', etc...];
var IPv6 = ['2400:cb00::/32', 2606:4700::/32, etc...];

Any ideas?

Matt

unread,
May 24, 2012, 9:14:38 AM5/24/12
to nod...@googlegroups.com
iptrie - is very fast but the documentation is a bit weak. https://github.com/postwait/node-iptrie

I'm pretty sure it supports IPv6 based on the source, even if the docs don't mention it.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Kevin Whitman

unread,
May 24, 2012, 8:43:43 PM5/24/12
to nod...@googlegroups.com
Over the past few hours I've hacked up a solution.  https://github.com/keverw/range_check
Reply all
Reply to author
Forward
0 new messages