MCPcopy Create free account
hub / github.com/qiyeboy/IPProxyPool / getAddr

Method getAddr

test/testIPAddress.py:41–64  ·  view source on GitHub ↗
(self, offset, ip=0)

Source from the content-addressed store, hash-verified

39 return self.getString(offset)
40
41 def getAddr(self, offset, ip=0):
42 self.ipdb.seek(offset + 4)
43 countryAddr = ""
44 areaAddr = ""
45 str = self.ipdb.read(1)
46 (byte,) = struct.unpack('B', str)
47 if byte == 0x01:
48 countryOffset = self.getLong3()
49 self.ipdb.seek(countryOffset)
50 str = self.ipdb.read(1)
51 (b,) = struct.unpack('B', str)
52 if b == 0x02:
53 countryAddr = self.getString(self.getLong3())
54 self.ipdb.seek(countryOffset + 4)
55 else:
56 countryAddr = self.getString(countryOffset)
57 areaAddr = self.getAreaAddr()
58 elif byte == 0x02:
59 countryAddr = self.getString(self.getLong3())
60 areaAddr = self.getAreaAddr(offset + 8)
61 else:
62 countryAddr = self.getString(offset + 4)
63 areaAddr = self.getAreaAddr()
64 return countryAddr + " " + areaAddr
65
66 def dump(self, first, last):
67 if last > self.indexCount:

Callers 2

dumpMethod · 0.95
getIpAddrMethod · 0.95

Calls 3

getLong3Method · 0.95
getStringMethod · 0.95
getAreaAddrMethod · 0.95

Tested by

no test coverage detected