Closed MrBruz closed 3 years ago
I was bored so I made a custom patch
answer_tracker = requests.get(tracker, params=params, timeout=5)
list_peers = bdecode(answer_tracker.content)
if type(list_peers['peers']) is bytes:
decodedPeersList = list_peers['peers'].hex()
decodedPeersList2 = [decodedPeersList[i:i+12] for i in range(0, len(decodedPeersList), 12)]
for x in decodedPeersList2:
ip = str(int(x[0:2], 16)) + "." + str(int(x[2:4], 16)) + "." + str(int(x[4:6], 16)) + "." + str(int(x[6:8], 16))
port = str(int(x[8:10], 16)) + str(int(x[10:12], 16))
#print("IP: " + ip +" PORT: " + port)
s = SockAddr(ip , port)
self.dict_sock_addr[s.__hash__()] = s
else:
for p in list_peers['peers']:
s = SockAddr(p['ip'], p['port'])
self.dict_sock_addr[s.__hash__()] = s
Patch starts at about line of line 89 of tracker.py
I'd recommend you merge this code with the main repo although make sure to test first @gallexis @FrozenFighter