docs: fix doc warning, fix incorrect refrences to 'webrtc'

This commit is contained in:
kozabrada123 2024-01-18 12:24:19 +01:00
parent 0d8fc2410c
commit cadaca90a1
11 changed files with 29 additions and 21 deletions

View File

@ -9,7 +9,7 @@ impl Guild {
/// 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.
/// 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:
/// See <https://discord-userdoccers.vercel.app/resources/message#search-messages>

View File

@ -63,7 +63,7 @@ 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?
///
@ -102,14 +102,14 @@ custom_error! {
///
/// 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)]
pub VoiceGatewayError
// Errors we receive
#[default]
UnknownOpcode = "You sent an invalid opcode",
FailedToDecodePayload = "You sent an invalid payload in your identifying to the (Webrtc) Gateway",
NotAuthenticated = "You sent a payload before identifying with 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 (Voice) Gateway",
AuthenticationFailed = "The token you sent in your identify payload is incorrect",
AlreadyAuthenticated = "You sent more than one identify payload",
SessionNoLongerValid = "Your session is no longer valid",

View File

@ -2,9 +2,9 @@ use crate::types::{Snowflake, WebSocketEvent};
use serde::{Deserialize, Serialize};
#[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>
pub struct VoiceIdentify {

View File

@ -27,7 +27,7 @@ mod ssrc_definition;
mod voice_backend_version;
#[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]
pub struct VoiceGatewaySendPayload {
@ -41,7 +41,7 @@ pub struct VoiceGatewaySendPayload {
impl WebSocketEvent for VoiceGatewaySendPayload {}
#[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
///

View File

@ -6,9 +6,12 @@ use serde::{Deserialize, Serialize};
use super::VoiceEncryptionMode;
#[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>
pub struct VoiceReady {
@ -16,7 +19,7 @@ pub struct VoiceReady {
pub ssrc: u32,
pub ip: Ipv4Addr,
pub port: u16,
/// The available encryption modes for the webrtc connection
/// The available encryption modes for the udp connection
pub modes: Vec<VoiceEncryptionMode>,
#[serde(default)]
pub experiments: Vec<String>,

View File

@ -3,7 +3,8 @@ use serde::{Deserialize, Serialize};
use super::VoiceEncryptionMode;
#[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>
pub struct SelectProtocol {
@ -39,6 +40,7 @@ pub enum VoiceProtocol {
/// See <https://discord-userdoccers.vercel.app/topics/voice-connections#protocol-data-structure>
pub struct SelectProtocolData {
/// Our external ip
// FIXME: This is a string
pub address: Vec<u8>,
/// Our external udp port
pub port: u16,

View File

@ -12,7 +12,7 @@ use crate::types::{Snowflake, WebSocketEvent};
pub struct Speaking {
/// Data about the audio we're transmitting.
///
/// See [SpeakingBitFlags]
/// See [SpeakingBitflags]
pub speaking: u8,
pub ssrc: u32,
/// The user id of the speaking user, only sent by the server

View File

@ -2,7 +2,7 @@ use crate::types::WebSocketEvent;
use serde::{Deserialize, Serialize};
#[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>
pub struct VoiceBackendVersion {

View File

@ -1,8 +1,8 @@
//! 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>
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
}
/// 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>
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
}
/// 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>
pub(crate) fn get_xsalsa20_poly1305_lite_nonce(packet: &[u8]) -> Vec<u8> {

View File

@ -1,6 +1,9 @@
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.
#[derive(Clone, Debug)]
pub struct VoiceGatewayMessage(pub String);

View File

@ -33,7 +33,7 @@ pub struct UdpHandle {
impl UdpHandle {
/// 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
/// If we do not have VoiceReady data, which contains our ssrc, this returns a