4 ms·
Or, much more easier for anyone else reading your code: ip.startswith('192.168.') or ip.startswith('10.') No, it's not as fast, but are you really doing tha
by tghw 17y ago
Or, much more easier for anyone else reading your code:
ip.startswith('192.168.') or ip.startswith('10.')
No, it's not as fast, but are you really doing that many is_ip_private() calls?
- tptacek 17y agoThat works for /16's and /8's. Now do it for /27.
- ars 17y agoGrab the last octet, and see if it's <= 30 Personally I store a string until 128bit math becomes easier (so I can handle IPv6). But usually I just want to log it, not check netmasks.
- tptacek 17y agoThere are, what, 8 /27s in a /24? How does seeing if the last octet is less than 30 help you?