From 01fce6c12407937a9d6075d78000d24864d7ff43 Mon Sep 17 00:00:00 2001 From: Jens Reidel Date: Mon, 11 Dec 2023 22:59:18 +0100 Subject: [PATCH] build(gateway, lavalink): Update to tokio-websockets 0.5 and rustls 0.22 Signed-off-by: Jens Reidel --- twilight-gateway/Cargo.toml | 6 +++--- twilight-gateway/src/connection.rs | 4 ++-- twilight-lavalink/Cargo.toml | 8 ++++---- twilight-lavalink/src/node.rs | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/twilight-gateway/Cargo.toml b/twilight-gateway/Cargo.toml index 55a4b8150f6..b14047e49ef 100644 --- a/twilight-gateway/Cargo.toml +++ b/twilight-gateway/Cargo.toml @@ -20,7 +20,7 @@ futures-util = { default-features = false, features = ["sink", "std"], version = serde = { default-features = false, features = ["derive"], version = "1" } serde_json = { default-features = false, features = ["std"], version = "1" } tokio = { default-features = false, features = ["net", "rt", "sync", "time"], version = "1.19" } -tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.4" } +tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.5" } tracing = { default-features = false, features = ["std", "attributes"], version = "0.1" } twilight-gateway-queue = { default-features = false, path = "../twilight-gateway-queue", version = "0.15.4" } twilight-model = { default-features = false, path = "../twilight-model", version = "0.15.4" } @@ -45,8 +45,8 @@ tracing-subscriber = { default-features = false, features = ["fmt", "tracing-log [features] default = ["rustls-native-roots", "twilight-http", "zlib-stock"] native = ["tokio-websockets/native-tls", "tokio-websockets/openssl"] -rustls-native-roots = ["tokio-websockets/rustls-native-roots"] -rustls-webpki-roots = ["tokio-websockets/rustls-webpki-roots"] +rustls-native-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-native-roots"] +rustls-webpki-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-webpki-roots"] zlib-simd = ["dep:flate2", "flate2?/zlib-ng"] zlib-stock = ["dep:flate2", "flate2?/zlib"] diff --git a/twilight-gateway/src/connection.rs b/twilight-gateway/src/connection.rs index aba90a10d6a..ee81f88a47f 100644 --- a/twilight-gateway/src/connection.rs +++ b/twilight-gateway/src/connection.rs @@ -6,7 +6,7 @@ use crate::{ }; use std::fmt::{Display, Formatter, Result as FmtResult}; use tokio::net::TcpStream; -use tokio_websockets::{ClientBuilder, Connector, Limits, MaybeTlsStream, WebsocketStream}; +use tokio_websockets::{ClientBuilder, Connector, Limits, MaybeTlsStream, WebSocketStream}; /// Query argument with zlib-stream enabled. #[cfg(any(feature = "zlib-stock", feature = "zlib-simd"))] @@ -24,7 +24,7 @@ const GATEWAY_URL: &str = "wss://gateway.discord.gg"; /// Connections are used by [`Shard`]s when reconnecting. /// /// [`Shard`]: crate::Shard -pub type Connection = WebsocketStream>; +pub type Connection = WebSocketStream>; /// Formatter for a gateway URL, with the API version and compression features /// specified. diff --git a/twilight-lavalink/Cargo.toml b/twilight-lavalink/Cargo.toml index ef697a1b786..675ef15a8d6 100644 --- a/twilight-lavalink/Cargo.toml +++ b/twilight-lavalink/Cargo.toml @@ -16,11 +16,11 @@ version = "0.15.3" [dependencies] dashmap = { default-features = false, version = "5.3" } futures-util = { default-features = false, features = ["bilock", "sink", "std", "unstable"], version = "0.3" } -http = { default-features = false, version = "0.2" } +http = { default-features = false, version = "1" } serde = { default-features = false, features = ["derive", "std"], version = "1" } serde_json = { default-features = false, features = ["std"], version = "1" } tokio = { default-features = false, features = ["macros", "net", "rt", "sync", "time"], version = "1.0" } -tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.4" } +tokio-websockets = { default-features = false, features = ["client", "fastrand", "sha1_smol", "simd"], version = "0.5" } tracing = { default-features = false, features = ["std", "attributes"], version = "0.1" } twilight-model = { default-features = false, path = "../twilight-model", version = "0.15.4" } @@ -40,8 +40,8 @@ twilight-http = { default-features = false, features = ["rustls-native-roots"], default = ["http-support", "rustls-native-roots"] http-support = ["dep:percent-encoding"] native = ["tokio-websockets/native-tls", "tokio-websockets/openssl"] -rustls-native-roots = ["tokio-websockets/rustls-native-roots"] -rustls-webpki-roots = ["tokio-websockets/rustls-webpki-roots"] +rustls-native-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-native-roots"] +rustls-webpki-roots = ["tokio-websockets/ring", "tokio-websockets/rustls-webpki-roots"] [package.metadata.docs.rs] all-features = true diff --git a/twilight-lavalink/src/node.rs b/twilight-lavalink/src/node.rs index ebc8691176d..98b801772af 100644 --- a/twilight-lavalink/src/node.rs +++ b/twilight-lavalink/src/node.rs @@ -41,7 +41,7 @@ use tokio::{ time as tokio_time, }; use tokio_websockets::{ - upgrade, ClientBuilder, Error as WebsocketError, MaybeTlsStream, Message, WebsocketStream, + upgrade, ClientBuilder, Error as WebsocketError, MaybeTlsStream, Message, WebSocketStream, }; use twilight_model::id::{marker::UserMarker, Id}; @@ -464,7 +464,7 @@ impl Node { struct Connection { config: NodeConfig, - connection: WebsocketStream>, + connection: WebSocketStream>, node_from: UnboundedReceiver, node_to: UnboundedSender, players: PlayerManager, @@ -635,7 +635,7 @@ fn connect_request(state: &NodeConfig) -> Result { async fn reconnect( config: &NodeConfig, -) -> Result>, NodeError> { +) -> Result>, NodeError> { let (mut stream, res) = backoff(config).await?; let headers = res.headers(); @@ -668,7 +668,7 @@ async fn backoff( config: &NodeConfig, ) -> Result< ( - WebsocketStream>, + WebSocketStream>, upgrade::Response, ), NodeError,