From 47cb6f365c16ccf418796bf132f77c14166156fa Mon Sep 17 00:00:00 2001 From: kozabrada123 <59031733+kozabrada123@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:51:52 +0200 Subject: [PATCH] Fix a bunch of typos Co-authored-by: Flori <39242991+bitfl0wer@users.noreply.github.com> --- examples/voice_simple/src/main.rs | 8 ++++---- src/errors.rs | 6 +++--- src/types/events/voice_gateway/mod.rs | 2 +- src/types/events/voice_gateway/ready.rs | 4 ++-- src/types/events/voice_gateway/select_protocol.rs | 6 +++--- src/types/events/voice_gateway/speaking.rs | 2 +- src/voice/gateway/handle.rs | 2 +- src/voice/gateway/message.rs | 2 +- src/voice/udp/handle.rs | 6 +++--- src/voice/udp/handler.rs | 8 ++++---- src/voice/udp/mod.rs | 2 +- src/voice/voice_data.rs | 6 +++--- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/examples/voice_simple/src/main.rs b/examples/voice_simple/src/main.rs index f369b31..a6f77db 100644 --- a/examples/voice_simple/src/main.rs +++ b/examples/voice_simple/src/main.rs @@ -40,7 +40,7 @@ use tokio::sync::{Mutex, RwLock}; extern crate chorus; extern crate tokio; -/// Handles inbetween connections between the gateway and udp modules +/// Handles in between connections between the gateway and UDP modules #[derive(Debug, Clone)] pub struct VoiceHandler { pub voice_gateway_connection: Arc>>, @@ -49,7 +49,7 @@ pub struct VoiceHandler { } impl VoiceHandler { - /// Creates a new voicehandler, only initializing the data + /// Creates a new [VoiceHandler], only initializing the data pub fn new() -> VoiceHandler { Self { data: Arc::new(RwLock::new(VoiceData::default())), @@ -66,7 +66,7 @@ impl Default for VoiceHandler { } #[async_trait] -// On [VoiceServerUpdate] we get our starting data and url for the voice gateway server. +// On [VoiceServerUpdate] we get our starting data and URL for the voice gateway server. impl Observer for VoiceHandler { async fn update(&self, data: &VoiceServerUpdate) { let mut data_lock = self.data.write().await; @@ -121,7 +121,7 @@ impl Observer for VoiceHandler { } #[async_trait] -// On [VoiceReady] we get info for establishing a UDP connection, and we immedietly need said UDP +// On [VoiceReady] we get info for establishing a UDP connection, and we immediately need said UDP // connection for ip discovery. impl Observer for VoiceHandler { async fn update(&self, data: &VoiceReady) { diff --git a/src/errors.rs b/src/errors.rs index 1e9087d..a2f174d 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -140,7 +140,7 @@ custom_error! { pub VoiceUdpError // General errors - BrokenSocket{error: String} = "Could not write / read from udp socket: {error}", + BrokenSocket{error: String} = "Could not write / read from UDP socket: {error}", NoData = "We have not set received the necessary data to perform this operation.", // Encryption errors @@ -151,8 +151,8 @@ custom_error! { FailedNonceGeneration{error: String} = "Tried to generate nonce, but failed due to error: {error}.", // Errors when initiating a socket connection - CannotBind{error: String} = "Cannot bind socket due to a udp error: {error}", - CannotConnect{error: String} = "Cannot connect due to a udp error: {error}", + CannotBind{error: String} = "Cannot bind socket due to a UDP error: {error}", + CannotConnect{error: String} = "Cannot connect due to a UDP error: {error}", } impl WebSocketEvent for VoiceUdpError {} diff --git a/src/types/events/voice_gateway/mod.rs b/src/types/events/voice_gateway/mod.rs index 4c4b4b2..0546d29 100644 --- a/src/types/events/voice_gateway/mod.rs +++ b/src/types/events/voice_gateway/mod.rs @@ -61,7 +61,7 @@ pub struct VoiceGatewayReceivePayload<'a> { impl<'a> WebSocketEvent for VoiceGatewayReceivePayload<'a> {} -/// The modes of encryption available in voice udp connections; +/// The modes of encryption available in voice UDP connections; /// /// Not all encryption modes are implemented; it is generally recommended /// to use either [[VoiceEncryptionMode::Xsalsa20Poly1305]] or diff --git a/src/types/events/voice_gateway/ready.rs b/src/types/events/voice_gateway/ready.rs index d876923..1f7f90f 100644 --- a/src/types/events/voice_gateway/ready.rs +++ b/src/types/events/voice_gateway/ready.rs @@ -12,7 +12,7 @@ use super::VoiceEncryptionMode; #[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)] /// The voice gateway's ready event; /// -/// Gives the user info about the udp connection ip and port, srrc to use, +/// 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. @@ -23,7 +23,7 @@ pub struct VoiceReady { pub ssrc: u32, pub ip: Ipv4Addr, pub port: u16, - /// The available encryption modes for the udp connection + /// The available encryption modes for the UDP connection pub modes: Vec, #[serde(default)] pub experiments: Vec, diff --git a/src/types/events/voice_gateway/select_protocol.rs b/src/types/events/voice_gateway/select_protocol.rs index bf032d8..375a12c 100644 --- a/src/types/events/voice_gateway/select_protocol.rs +++ b/src/types/events/voice_gateway/select_protocol.rs @@ -34,7 +34,7 @@ pub enum VoiceProtocol { #[default] /// Sending data via UDP, documented and the only protocol chorus supports. Udp, - // Possible value, yet NOT RECOMMENED, AS CHORUS DOES NOT SUPPORT WEBRTC + // Possible value, yet NOT RECOMMENDED, AS CHORUS DOES NOT SUPPORT WEBRTC //Webrtc, } @@ -43,9 +43,9 @@ pub enum VoiceProtocol { /// /// See pub struct SelectProtocolData { - /// Our external ip we got from ip discovery + /// Our external IP we got from IP discovery pub address: String, - /// Our external udp port we got from id discovery + /// Our external UDP port we got from IP discovery pub port: u16, /// The mode of encryption to use pub mode: VoiceEncryptionMode, diff --git a/src/types/events/voice_gateway/speaking.rs b/src/types/events/voice_gateway/speaking.rs index 6a811f2..a18ba77 100644 --- a/src/types/events/voice_gateway/speaking.rs +++ b/src/types/events/voice_gateway/speaking.rs @@ -9,7 +9,7 @@ use crate::types::{Snowflake, WebSocketEvent}; /// Event that tells the server we are speaking; /// -/// Essentially, what allows us to send udp data and lights up the green circle around your avatar. +/// Essentially, what allows us to send UDP data and lights up the green circle around your avatar. /// /// See #[derive(Debug, Deserialize, Serialize, Clone, Default)] diff --git a/src/voice/gateway/handle.rs b/src/voice/gateway/handle.rs index 95cf9a4..b48080a 100644 --- a/src/voice/gateway/handle.rs +++ b/src/voice/gateway/handle.rs @@ -97,7 +97,7 @@ impl VoiceGatewayHandle { /// Closes the websocket connection and stops all gateway tasks; /// - /// Esentially pulls the plug on the voice gateway, leaving it possible to resume; + /// Essentially pulls the plug on the voice gateway, leaving it possible to resume; pub async fn close(&self) { self.kill_send.send(()).unwrap(); self.websocket_send.lock().await.close().await.unwrap(); diff --git a/src/voice/gateway/message.rs b/src/voice/gateway/message.rs index e3938cc..4b40f35 100644 --- a/src/voice/gateway/message.rs +++ b/src/voice/gateway/message.rs @@ -14,7 +14,7 @@ pub struct VoiceGatewayMessage(pub String); impl VoiceGatewayMessage { /// Parses the message as an error; - /// Returns the error if succesfully parsed, None if the message isn't an error + /// Returns the error if successfully parsed, None if the message isn't an error pub fn error(&self) -> Option { // Some error strings have dots on the end, which we don't care about let processed_content = self.0.to_lowercase().replace('.', ""); diff --git a/src/voice/udp/handle.rs b/src/voice/udp/handle.rs index ecaf3ab..516ad7d 100644 --- a/src/voice/udp/handle.rs +++ b/src/voice/udp/handle.rs @@ -24,7 +24,7 @@ use crate::{ use super::{events::VoiceUDPEvents, RTP_HEADER_SIZE}; -/// Handle to a voice udp connection +/// Handle to a voice UDP connection /// /// Can be safely cloned and will still correspond to the same connection. #[derive(Debug, Clone)] @@ -45,7 +45,7 @@ impl UdpHandle { /// /// If we have not received an encryption key, this returns a [VoiceUdpError::NoKey] error. /// - /// If the Udp socket is broken, this returns a [VoiceUdpError::BrokenSocket] error. + /// If the UDP socket is broken, this returns a [VoiceUdpError::BrokenSocket] error. pub async fn send_opus_data( &self, timestamp: u32, @@ -212,7 +212,7 @@ impl UdpHandle { let mut encrypted_payload = encryption_result.unwrap(); // Append the nonce bytes, if needed - // All other encryption modes have an explicit nonce, where as Xsalsa20Poly1305 + // All other encryption modes have an explicit nonce, whereas Xsalsa20Poly1305 // has the nonce as the rtp header. if session_description.encryption_mode != VoiceEncryptionMode::Xsalsa20Poly1305 { encrypted_payload.append(&mut nonce_bytes); diff --git a/src/voice/udp/handler.rs b/src/voice/udp/handler.rs index fcaa7a7..c21709b 100644 --- a/src/voice/udp/handler.rs +++ b/src/voice/udp/handler.rs @@ -42,9 +42,9 @@ pub struct UdpHandler { } impl UdpHandler { - /// Spawns a new udp handler and performs ip discovery. + /// Spawns a new UDP handler and performs IP discovery. /// - /// Mutates the given data_reference with the ip discovery data. + /// Mutates the given data_reference with the IP discovery data. pub async fn spawn( data_reference: Arc>, url: SocketAddr, @@ -141,7 +141,7 @@ impl UdpHandler { /// The main listen task; /// - /// Receives udp messages and parses them. + /// Receives UDP messages and parses them. async fn listen_task(&mut self) { loop { // FIXME: is there a max size for these packets? @@ -150,7 +150,7 @@ impl UdpHandler { // Update: see // > "The RTP standard does not set a maximum size.." // - // The theorhetical max for this buffer would be 1458 bytes, but that is imo + // The theoretical max for this buffer would be 1458 bytes, but that is imo // unreasonable to allocate for every message. let mut buf: Vec = vec![0; 512]; diff --git a/src/voice/udp/mod.rs b/src/voice/udp/mod.rs index a61df21..5ae839a 100644 --- a/src/voice/udp/mod.rs +++ b/src/voice/udp/mod.rs @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -//! Defines the udp component of voice communications, sending and receiving raw rtp data. +//! Defines the UDP component of voice communications, sending and receiving raw rtp data. /// See /// This always adds up to 12 bytes diff --git a/src/voice/voice_data.rs b/src/voice/voice_data.rs index 21f7d84..6bc408c 100644 --- a/src/voice/voice_data.rs +++ b/src/voice/voice_data.rs @@ -9,17 +9,17 @@ use crate::types::{SessionDescription, Snowflake, VoiceReady, VoiceServerUpdate} #[derive(Debug, Default)] /// Saves data shared between parts of the voice architecture; /// -/// Struct used to give the Udp connection data received from the gateway. +/// Struct used to give the UDP connection data received from the gateway. pub struct VoiceData { pub server_data: Option, pub ready_data: Option, pub session_description: Option, pub user_id: Snowflake, pub session_id: String, - /// The last sequence number we used, has to be incremeted by one every time we send a message + /// The last sequence number we used, has to be incremented by one every time we send a message pub last_sequence_number: u16, pub ip_discovery: Option, - /// The last udp encryption nonce, if we are using an encryption mode with incremental nonces. + /// The last UDP encryption nonce, if we are using an encryption mode with incremental nonces. pub last_udp_encryption_nonce: Option, }