Commit 0c3a754e by William Tisäter

Add internal `_netmask` property for future features

Related to issue #47
parent 0110bc32
......@@ -98,6 +98,7 @@ class GeoIP(object):
@type cache: bool
"""
self._flags = flags
self._netmask = None
if self._flags & const.MMAP_CACHE and mmap is None: # pragma: no cover
import warnings
......@@ -253,10 +254,12 @@ class GeoIP(object):
x[i] += ord(byte) << (j * 8)
if ipnum & (1 << depth):
if x[1] >= self._databaseSegments:
self._netmask = seek_depth - depth + 1
return x[1]
offset = x[1]
else:
if x[0] >= self._databaseSegments:
self._netmask = seek_depth - depth + 1
return x[0]
offset = x[0]
except (IndexError, UnicodeDecodeError):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment