mirror of
https://github.com/YGGverse/pymaster.git
synced 2025-02-08 04:54:20 +00:00
add IPv6 support for queryAddr pack
This commit is contained in:
parent
2f9c232540
commit
5f07a83832
@ -1,5 +1,6 @@
|
|||||||
from time import time
|
from time import time
|
||||||
from struct import pack
|
from struct import pack
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
class ServerEntry:
|
class ServerEntry:
|
||||||
challenge2 = 0
|
challenge2 = 0
|
||||||
@ -67,8 +68,7 @@ class ServerEntry:
|
|||||||
self.addr = addr
|
self.addr = addr
|
||||||
# Shortcuts for generating query
|
# Shortcuts for generating query
|
||||||
self.queryAddr = b''
|
self.queryAddr = b''
|
||||||
for i in addr[0].split('.'):
|
self.queryAddr += ipaddress.ip_address(addr[0]).packed
|
||||||
self.queryAddr += pack('!B', int(i))
|
|
||||||
self.queryAddr += pack('!H', int(addr[1]))
|
self.queryAddr += pack('!H', int(addr[1]))
|
||||||
|
|
||||||
# Random number that server must return
|
# Random number that server must return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user