mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 01:53:30 +01:00
voice: support xsalsa20_poly1305_lite and xsalsa20_poly1305_suffix
This commit is contained in:
@@ -8,6 +8,12 @@ const EventEmitter = require('events');
|
||||
const { Error } = require('../../errors');
|
||||
const PlayInterface = require('./util/PlayInterface');
|
||||
|
||||
const SUPPORTED_MODES = [
|
||||
'xsalsa20_poly1305_lite',
|
||||
'xsalsa20_poly1305_suffix',
|
||||
'xsalsa20_poly1305',
|
||||
];
|
||||
|
||||
/**
|
||||
* Represents a connection to a guild's voice server.
|
||||
* ```js
|
||||
@@ -382,9 +388,16 @@ class VoiceConnection extends EventEmitter {
|
||||
* @param {Object} data The received data
|
||||
* @private
|
||||
*/
|
||||
onReady({ port, ssrc, ip }) {
|
||||
onReady({ port, ssrc, ip, modes }) {
|
||||
this.authentication.port = port;
|
||||
this.authentication.ssrc = ssrc;
|
||||
for (let mode of modes) {
|
||||
if (SUPPORTED_MODES.includes(mode)) {
|
||||
this.authentication.encryptionMode = mode;
|
||||
this.emit('debug', `Selecting the ${mode} mode`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.sockets.udp.createUDPSocket(ip);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user