mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-10 16:12:22 +03:00
Fix StringSession usage of IPv6 (#3726)
This commit is contained in:
parent
8aa4d9a263
commit
4fae119a18
|
@ -74,15 +74,15 @@ class StringSession(MemorySession):
|
||||||
if not self.state:
|
if not self.state:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if self.state.ipv6 is not None:
|
if self.dcs[self.state.dc_id].ipv6 is not None:
|
||||||
ip = self.state.ipv6.to_bytes(16, 'big', signed=False)
|
ip = self.dcs[self.state.dc_id].ipv6.to_bytes(16, 'big', signed=False)
|
||||||
else:
|
else:
|
||||||
ip = self.state.ipv6.to_bytes(4, 'big', signed=False)
|
ip = self.dcs[self.state.dc_id].ipv6.to_bytes(4, 'big', signed=False)
|
||||||
|
|
||||||
return CURRENT_VERSION + StringSession.encode(struct.pack(
|
return CURRENT_VERSION + StringSession.encode(struct.pack(
|
||||||
_STRUCT_PREFORMAT.format(len(ip)),
|
_STRUCT_PREFORMAT.format(len(ip)),
|
||||||
self.state.dc_id,
|
self.state.dc_id,
|
||||||
ip,
|
ip,
|
||||||
self.state.port,
|
self.dcs[self.state.dc_id].port,
|
||||||
self.dcs[self.state.dc_id].auth
|
self.dcs[self.state.dc_id].auth
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user