Converting IPv4 or IPv6 address to a long for comparisons
- by Justin Akehurst
In order to check if an IPv4 or IPv6 address is within a certain range, I've got code that takes an IPv4 address, turns that into a long, then does that same conversion on the upper/lower bound of the subnet, then checks to see if the long is between those values.
I'd like to be able to do the same thing for IPv6, but saw nothing in the Python 2.6…