From 577726f3bdcb4b8520cd8d79b5f1cdc96a1ea68a Mon Sep 17 00:00:00 2001 From: kozabrada123 <59031733+kozabrada123@users.noreply.github.com> Date: Sat, 20 Jan 2024 12:18:03 +0100 Subject: [PATCH] fix: use ip discovery address as string, not as Vec --- src/types/events/voice_gateway/select_protocol.rs | 7 +++---- src/voice/handler.rs | 4 +++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/types/events/voice_gateway/select_protocol.rs b/src/types/events/voice_gateway/select_protocol.rs index afdd86a..6e85bcf 100644 --- a/src/types/events/voice_gateway/select_protocol.rs +++ b/src/types/events/voice_gateway/select_protocol.rs @@ -39,10 +39,9 @@ pub enum VoiceProtocol { /// /// See pub struct SelectProtocolData { - /// Our external ip - // FIXME: This is a string - pub address: Vec, - /// Our external udp port + /// Our external ip we got from ip discovery + pub address: String, + /// Our external udp port we got from id discovery pub port: u16, /// The mode of encryption to use pub mode: VoiceEncryptionMode, diff --git a/src/voice/handler.rs b/src/voice/handler.rs index aa3abcb..82ebc6e 100644 --- a/src/voice/handler.rs +++ b/src/voice/handler.rs @@ -111,6 +111,8 @@ impl Observer for VoiceHandler { *self.voice_udp_connection.lock().await = Some(udp_handle.clone()); + let string_ip_address = String::from_utf8(ip_discovery.address).expect("Ip discovery gave non string ip"); + self.voice_gateway_connection .lock() .await @@ -119,7 +121,7 @@ impl Observer for VoiceHandler { .send_select_protocol(SelectProtocol { protocol: VoiceProtocol::Udp, data: SelectProtocolData { - address: ip_discovery.address, + address: string_ip_address, port: ip_discovery.port, mode: VoiceEncryptionMode::Xsalsa20Poly1305, },