The port is a big endian unsigned short.
See https://github.com/discordapp/discord-api-docs/pull/1244
This commit is contained in:
parent
b458cc7b7d
commit
1b9108ffd7
@ -721,9 +721,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol):
|
||||
ip_end = recv.index(0, ip_start)
|
||||
state.ip = recv[ip_start:ip_end].decode('ascii')
|
||||
|
||||
# the port is a little endian unsigned short in the last two bytes
|
||||
# yes, this is different endianness from everything else
|
||||
state.port = struct.unpack_from('<H', recv, len(recv) - 2)[0]
|
||||
state.port = struct.unpack_from('>H', recv, len(recv) - 2)[0]
|
||||
log.debug('detected ip: %s port: %s', state.ip, state.port)
|
||||
|
||||
# there *should* always be at least one supported mode (xsalsa20_poly1305)
|
||||
|
Loading…
x
Reference in New Issue
Block a user