docs: fix doc warning, fix incorrect refrences to 'webrtc'
This commit is contained in:
parent
fd8176f0b6
commit
15bd55cf3d
|
@ -9,7 +9,7 @@ impl Guild {
|
||||||
/// permission to be present on the current user.
|
/// permission to be present on the current user.
|
||||||
///
|
///
|
||||||
/// If the guild/channel you are searching is not yet indexed, the endpoint will return a 202 accepted response.
|
/// If the guild/channel you are searching is not yet indexed, the endpoint will return a 202 accepted response.
|
||||||
/// In this case, the method will return a [`ChorusError::InvalidResponse`] error.
|
/// In this case, the method will return a [`ChorusError::InvalidResponse`](crate::errors::ChorusError::InvalidResponse) error.
|
||||||
///
|
///
|
||||||
/// # Reference:
|
/// # Reference:
|
||||||
/// See <https://discord-userdoccers.vercel.app/resources/message#search-messages>
|
/// See <https://discord-userdoccers.vercel.app/resources/message#search-messages>
|
||||||
|
|
|
@ -63,7 +63,7 @@ custom_error! {
|
||||||
}
|
}
|
||||||
|
|
||||||
custom_error! {
|
custom_error! {
|
||||||
/// For errors we receive from the gateway, see https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#gateway-close-event-codes;
|
/// For errors we receive from the gateway, see <https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#gateway-close-event-codes>;
|
||||||
///
|
///
|
||||||
/// Supposed to be sent as numbers, though they are sent as string most of the time?
|
/// Supposed to be sent as numbers, though they are sent as string most of the time?
|
||||||
///
|
///
|
||||||
|
@ -102,14 +102,14 @@ custom_error! {
|
||||||
///
|
///
|
||||||
/// Similar to [GatewayError].
|
/// Similar to [GatewayError].
|
||||||
///
|
///
|
||||||
/// See https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice;
|
/// See <https://discord.com/developers/docs/topics/opcodes-and-status-codes#voice-voice-close-event-codes>;
|
||||||
#[derive(Clone, Default, PartialEq, Eq)]
|
#[derive(Clone, Default, PartialEq, Eq)]
|
||||||
pub VoiceGatewayError
|
pub VoiceGatewayError
|
||||||
// Errors we receive
|
// Errors we receive
|
||||||
#[default]
|
#[default]
|
||||||
UnknownOpcode = "You sent an invalid opcode",
|
UnknownOpcode = "You sent an invalid opcode",
|
||||||
FailedToDecodePayload = "You sent an invalid payload in your identifying to the (Webrtc) Gateway",
|
FailedToDecodePayload = "You sent an invalid payload in your identifying to the (Voice) Gateway",
|
||||||
NotAuthenticated = "You sent a payload before identifying with the (Webrtc) Gateway",
|
NotAuthenticated = "You sent a payload before identifying with the (Voice) Gateway",
|
||||||
AuthenticationFailed = "The token you sent in your identify payload is incorrect",
|
AuthenticationFailed = "The token you sent in your identify payload is incorrect",
|
||||||
AlreadyAuthenticated = "You sent more than one identify payload",
|
AlreadyAuthenticated = "You sent more than one identify payload",
|
||||||
SessionNoLongerValid = "Your session is no longer valid",
|
SessionNoLongerValid = "Your session is no longer valid",
|
||||||
|
|
|
@ -2,9 +2,9 @@ use crate::types::{Snowflake, WebSocketEvent};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// The identify payload for the webrtc stream;
|
/// The identify payload for the voice gateway connection;
|
||||||
///
|
///
|
||||||
/// Contains info to begin a webrtc connection;
|
/// Contains authentication info and context to authenticate to the voice gateway.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#identify-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#identify-structure>
|
||||||
pub struct VoiceIdentify {
|
pub struct VoiceIdentify {
|
||||||
|
|
|
@ -27,7 +27,7 @@ mod ssrc_definition;
|
||||||
mod voice_backend_version;
|
mod voice_backend_version;
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Clone)]
|
#[derive(Debug, Default, Serialize, Clone)]
|
||||||
/// The payload used for sending events to the webrtc gateway.
|
/// The payload used for sending events to the voice gateway.
|
||||||
///
|
///
|
||||||
/// Similar to [VoiceGatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
/// Similar to [VoiceGatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
||||||
pub struct VoiceGatewaySendPayload {
|
pub struct VoiceGatewaySendPayload {
|
||||||
|
@ -41,7 +41,7 @@ pub struct VoiceGatewaySendPayload {
|
||||||
impl WebSocketEvent for VoiceGatewaySendPayload {}
|
impl WebSocketEvent for VoiceGatewaySendPayload {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// The payload used for receiving events from the webrtc gateway.
|
/// The payload used for receiving events from the voice gateway.
|
||||||
///
|
///
|
||||||
/// Note that this is similar to the regular gateway, except we no longer have s or t
|
/// Note that this is similar to the regular gateway, except we no longer have s or t
|
||||||
///
|
///
|
||||||
|
|
|
@ -6,9 +6,12 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::VoiceEncryptionMode;
|
use super::VoiceEncryptionMode;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// The ready event for the webrtc stream;
|
/// The voice gateway's ready event;
|
||||||
///
|
///
|
||||||
/// Used to give info after the identify event;
|
/// Gives the user info about the udp connection ip and port, srrc to use,
|
||||||
|
/// available encryption modes and other data.
|
||||||
|
///
|
||||||
|
/// Sent in response to an Identify event.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#ready-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#ready-structure>
|
||||||
pub struct VoiceReady {
|
pub struct VoiceReady {
|
||||||
|
@ -16,7 +19,7 @@ pub struct VoiceReady {
|
||||||
pub ssrc: u32,
|
pub ssrc: u32,
|
||||||
pub ip: Ipv4Addr,
|
pub ip: Ipv4Addr,
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
/// The available encryption modes for the webrtc connection
|
/// The available encryption modes for the udp connection
|
||||||
pub modes: Vec<VoiceEncryptionMode>,
|
pub modes: Vec<VoiceEncryptionMode>,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub experiments: Vec<String>,
|
pub experiments: Vec<String>,
|
||||||
|
|
|
@ -3,7 +3,8 @@ use serde::{Deserialize, Serialize};
|
||||||
use super::VoiceEncryptionMode;
|
use super::VoiceEncryptionMode;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
/// An event sent by the client to the webrtc server, detailing what protocol, address and encryption to use;
|
/// An event sent by the client to the voice gateway server,
|
||||||
|
/// detailing what protocol, address and encryption to use;
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#select-protocol-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#select-protocol-structure>
|
||||||
pub struct SelectProtocol {
|
pub struct SelectProtocol {
|
||||||
|
@ -39,6 +40,7 @@ pub enum VoiceProtocol {
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#protocol-data-structure>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#protocol-data-structure>
|
||||||
pub struct SelectProtocolData {
|
pub struct SelectProtocolData {
|
||||||
/// Our external ip
|
/// Our external ip
|
||||||
|
// FIXME: This is a string
|
||||||
pub address: Vec<u8>,
|
pub address: Vec<u8>,
|
||||||
/// Our external udp port
|
/// Our external udp port
|
||||||
pub port: u16,
|
pub port: u16,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::types::{Snowflake, WebSocketEvent};
|
||||||
pub struct Speaking {
|
pub struct Speaking {
|
||||||
/// Data about the audio we're transmitting.
|
/// Data about the audio we're transmitting.
|
||||||
///
|
///
|
||||||
/// See [SpeakingBitFlags]
|
/// See [SpeakingBitflags]
|
||||||
pub speaking: u8,
|
pub speaking: u8,
|
||||||
pub ssrc: u32,
|
pub ssrc: u32,
|
||||||
/// The user id of the speaking user, only sent by the server
|
/// The user id of the speaking user, only sent by the server
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::types::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq)]
|
#[derive(Debug, Default, Deserialize, Serialize, Clone, PartialEq)]
|
||||||
/// Received from the server to describe the backend version.
|
/// Received from the voice gateway server to describe the backend version.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#voice-backend-version>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#voice-backend-version>
|
||||||
pub struct VoiceBackendVersion {
|
pub struct VoiceBackendVersion {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//! Defines cryptography functions used within the voice implementation.
|
//! Defines cryptography functions used within the voice implementation.
|
||||||
//!
|
//!
|
||||||
//! All functions in this module return a 24 byte long [Vec<u8>].
|
//! All functions in this module return a 24 byte long `Vec<u8>`.
|
||||||
|
|
||||||
/// Gets an xsalsa20_poly1305 nonce from an rtppacket.
|
/// Gets an `xsalsa20_poly1305` nonce from an rtppacket.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
||||||
pub(crate) fn get_xsalsa20_poly1305_nonce(packet: &[u8]) -> Vec<u8> {
|
pub(crate) fn get_xsalsa20_poly1305_nonce(packet: &[u8]) -> Vec<u8> {
|
||||||
|
@ -17,7 +17,7 @@ pub(crate) fn get_xsalsa20_poly1305_nonce(packet: &[u8]) -> Vec<u8> {
|
||||||
rtp_header
|
rtp_header
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets an xsalsa20_poly1305_suffix nonce from an rtppacket.
|
/// Gets an `xsalsa20_poly1305_suffix` nonce from an rtppacket.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
||||||
pub(crate) fn get_xsalsa20_poly1305_suffix_nonce(packet: &[u8]) -> Vec<u8> {
|
pub(crate) fn get_xsalsa20_poly1305_suffix_nonce(packet: &[u8]) -> Vec<u8> {
|
||||||
|
@ -28,7 +28,7 @@ pub(crate) fn get_xsalsa20_poly1305_suffix_nonce(packet: &[u8]) -> Vec<u8> {
|
||||||
nonce
|
nonce
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets an xsalsa20_poly1305_lite nonce from an rtppacket.
|
/// Gets an `xsalsa20_poly1305_lite` nonce from an rtppacket.
|
||||||
///
|
///
|
||||||
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#encryption-mode>
|
||||||
pub(crate) fn get_xsalsa20_poly1305_lite_nonce(packet: &[u8]) -> Vec<u8> {
|
pub(crate) fn get_xsalsa20_poly1305_lite_nonce(packet: &[u8]) -> Vec<u8> {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
use crate::{errors::VoiceGatewayError, types::VoiceGatewayReceivePayload};
|
use crate::{errors::VoiceGatewayError, types::VoiceGatewayReceivePayload};
|
||||||
|
|
||||||
/// Represents a messsage received from the webrtc socket. This will be either a [GatewayReceivePayload], containing webrtc events, or a [WebrtcError].
|
/// Represents a messsage received from the voice websocket connection.
|
||||||
|
///
|
||||||
|
/// This will be either a [VoiceGatewayReceivePayload], containing voice gateway events, or a [VoiceGatewayError].
|
||||||
|
///
|
||||||
/// This struct is used internally when handling messages.
|
/// This struct is used internally when handling messages.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct VoiceGatewayMessage(pub String);
|
pub struct VoiceGatewayMessage(pub String);
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub struct UdpHandle {
|
||||||
impl UdpHandle {
|
impl UdpHandle {
|
||||||
/// Constructs and sends encoded opus rtp data.
|
/// Constructs and sends encoded opus rtp data.
|
||||||
///
|
///
|
||||||
/// Automatically makes an [RtpPacket](discorrtp::rtp::RtpPacket), encrypts it and sends it.
|
/// Automatically makes an [RtpPacket](discortp::rtp::RtpPacket), encrypts it and sends it.
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
/// If we do not have VoiceReady data, which contains our ssrc, this returns a
|
/// If we do not have VoiceReady data, which contains our ssrc, this returns a
|
||||||
|
|
Loading…
Reference in New Issue