Encryption dispatch for Discord voice.
Selects the appropriate encryption module based on the negotiated mode and handles RTP packet construction.
Summary
Functions
Decrypts a received voice packet.
Encrypts an opus frame with the RTP header prepended.
Builds an RTP header.
Selects the best encryption mode from the server's available modes.
Functions
Decrypts a received voice packet.
For _rtpsize modes, the AAD is the RTP header + extension preamble (if present).
The extension elements themselves are encrypted and must be stripped after decryption.
Returns {:ok, opus_data} or :error.
@spec encrypt_packet( binary(), integer(), integer(), integer(), binary(), String.t(), integer() ) :: binary()
Encrypts an opus frame with the RTP header prepended.
Returns the full encrypted packet ready to send over UDP.
Builds an RTP header.
Format: <<0x80, 0x78, sequence::16-big, timestamp::32-big, ssrc::32-big>>
Selects the best encryption mode from the server's available modes.
Returns {:ok, mode} or :error if no supported mode is available.