From 51815219eaca5a4caebf7424bb05ea95c86826e2 Mon Sep 17 00:00:00 2001 From: Sebastian Holmin Date: Mon, 23 Sep 2024 17:16:24 +0200 Subject: [PATCH] Upgrade `tonic` to 0.12 and `prost` to 0.13 Upgrading `tonic` is a prerequisite to later on upgrading `hyper` to version 1.0. As of version 1.0, `hyper` no longer uses `tokio`s `AsyncWriter` and `AsyncReader` traits, instead defining its own versions, see . As tonic `0.12` is updated to use the `hyper 1.0` ecosystem, it changed some of its trait-bounds to the new `hyper` traits. The `hyper-utils` crate provides the wrapper `TokioIo`, which converts between the two. `prost` had to be upgraded as well, for compatibility. --- Cargo.lock | 140 ++++++---- Cargo.toml | 7 +- mullvad-ios/Cargo.toml | 1 + .../src/ephemeral_peer_proxy/ios_runtime.rs | 20 +- mullvad-management-interface/Cargo.toml | 1 + mullvad-management-interface/src/lib.rs | 4 +- talpid-openvpn-plugin/Cargo.toml | 2 + talpid-openvpn-plugin/src/processing.rs | 10 +- talpid-tunnel-config-client/Cargo.toml | 1 + talpid-tunnel-config-client/src/lib.rs | 7 +- test/Cargo.lock | 244 ++++++++++++++---- test/Cargo.toml | 6 +- test/test-manager/Cargo.toml | 1 + test/test-manager/src/mullvad_daemon.rs | 13 +- 14 files changed, 326 insertions(+), 131 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed52bbb2f8e3..c148120c64ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -225,18 +225,17 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" -version = "0.6.20" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "itoa", "matchit", "memchr", @@ -253,17 +252,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "5e6b8ba012a258d63c9adfa28b9ddcf66149da6f986c5b5452e629d5ee64bf00" dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper", "tower-layer", "tower-service", ] @@ -1544,7 +1546,6 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -1581,14 +1582,35 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper 0.14.28", + "hyper 1.4.1", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.0", + "hyper 1.4.1", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -2422,6 +2444,7 @@ name = "mullvad-ios" version = "0.0.0" dependencies = [ "cbindgen", + "hyper-util", "libc", "log", "mullvad-encrypted-dns-proxy", @@ -2462,13 +2485,14 @@ version = "0.0.0" dependencies = [ "chrono", "futures", + "hyper-util", "log", "mullvad-paths", "mullvad-types", "nix 0.23.2", "parity-tokio-ipc", - "prost", - "prost-types", + "prost 0.13.3", + "prost-types 0.13.3", "talpid-types", "thiserror", "tokio", @@ -3229,7 +3253,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.4", +] + +[[package]] +name = "prost" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +dependencies = [ + "bytes", + "prost-derive 0.13.3", ] [[package]] @@ -3246,8 +3280,8 @@ dependencies = [ "once_cell", "petgraph", "prettyplease", - "prost", - "prost-types", + "prost 0.12.4", + "prost-types 0.12.4", "regex", "syn 2.0.60", "tempfile", @@ -3266,13 +3300,35 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "prost-derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "prost-types" version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost", + "prost 0.12.4", +] + +[[package]] +name = "prost-types" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" +dependencies = [ + "prost 0.13.3", ] [[package]] @@ -3982,9 +4038,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "synstructure" @@ -4112,7 +4168,7 @@ dependencies = [ "log", "once_cell", "parity-tokio-ipc", - "prost", + "prost 0.13.3", "shadowsocks-service", "shell-escape", "talpid-routing", @@ -4135,11 +4191,13 @@ name = "talpid-openvpn-plugin" version = "0.0.0" dependencies = [ "env_logger 0.10.2", + "futures", + "hyper-util", "log", "mullvad-version", "openvpn-plugin", "parity-tokio-ipc", - "prost", + "prost 0.13.3", "talpid-types", "thiserror", "tokio", @@ -4215,11 +4273,12 @@ name = "talpid-tunnel-config-client" version = "0.0.0" dependencies = [ "classic-mceliece-rust", + "hyper-util", "libc", "log", "oslog", "pqc_kyber", - "prost", + "prost 0.13.3", "rand 0.8.5", "talpid-types", "tokio", @@ -4402,16 +4461,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.4.0" @@ -4512,23 +4561,26 @@ dependencies = [ [[package]] name = "tonic" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.0", "bytes", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.28", + "h2 0.4.4", + "http 1.1.0", + "http-body 1.0.0", + "http-body-util", + "hyper 1.4.1", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", - "prost", + "prost 0.13.3", + "socket2", "tokio", "tokio-stream", "tower", diff --git a/Cargo.toml b/Cargo.toml index 0b674d289be5..6ce3b1dcc262 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,11 +67,12 @@ unused_async = "deny" [workspace.dependencies] tokio = { version = "1.8" } # Tonic and related crates -tonic = "0.10.0" +tonic = "0.12.2" tonic-build = { version = "0.10.0", default-features = false } tower = "0.4" -prost = "0.12.0" -prost-types = "0.12.0" +prost = "0.13.3" +prost-types = "0.13.3" +hyper-util = "0.1.8" env_logger = "0.10.0" thiserror = "1.0.57" diff --git a/mullvad-ios/Cargo.toml b/mullvad-ios/Cargo.toml index 83d3af744750..294d707e79e6 100644 --- a/mullvad-ios/Cargo.toml +++ b/mullvad-ios/Cargo.toml @@ -15,6 +15,7 @@ libc = "0.2" log = { workspace = true } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } tonic = { workspace = true } +hyper-util = { workspace = true } tower = { workspace = true } tunnel-obfuscation = { path = "../tunnel-obfuscation" } oslog = "0.2" diff --git a/mullvad-ios/src/ephemeral_peer_proxy/ios_runtime.rs b/mullvad-ios/src/ephemeral_peer_proxy/ios_runtime.rs index 7dbf5c21e1c4..19107689ab29 100644 --- a/mullvad-ios/src/ephemeral_peer_proxy/ios_runtime.rs +++ b/mullvad-ios/src/ephemeral_peer_proxy/ios_runtime.rs @@ -3,10 +3,7 @@ use super::{ }; use libc::c_void; use std::{ - future::Future, - io, - pin::Pin, - ptr, + io, ptr, sync::{Arc, Mutex}, }; use talpid_tunnel_config_client::{request_ephemeral_peer_with, Error, RelayConfigService}; @@ -104,14 +101,13 @@ impl IOSRuntime { // One (1) TCP connection let mut one_tcp_connection = Some(tcp_provider); let conn = endpoint - .connect_with_connector(service_fn( - move |_| -> Pin + Send>> { - if let Some(connection) = one_tcp_connection.take() { - return Box::pin(async move { Ok::<_, Error>(connection) }); - } - Box::pin(async { Err(Error::TcpConnectionExpired) }) - }, - )) + .connect_with_connector(service_fn(move |_| { + let connection = one_tcp_connection + .take() + .map(hyper_util::rt::tokio::TokioIo::new) + .ok_or(Error::TcpConnectionExpired); + async { connection } + })) .await .map_err(Error::GrpcConnectError)?; diff --git a/mullvad-management-interface/Cargo.toml b/mullvad-management-interface/Cargo.toml index 75c6f1b0adc0..6b42ed481a45 100644 --- a/mullvad-management-interface/Cargo.toml +++ b/mullvad-management-interface/Cargo.toml @@ -18,6 +18,7 @@ mullvad-paths = { path = "../mullvad-paths" } talpid-types = { path = "../talpid-types" } tonic = { workspace = true } tower = { workspace = true } +hyper-util = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } parity-tokio-ipc = "0.9" diff --git a/mullvad-management-interface/src/lib.rs b/mullvad-management-interface/src/lib.rs index 7abe9f761c08..b26f29fe71bd 100644 --- a/mullvad-management-interface/src/lib.rs +++ b/mullvad-management-interface/src/lib.rs @@ -117,12 +117,14 @@ pub enum Error { #[cfg(not(target_os = "android"))] #[deprecated(note = "Prefer MullvadProxyClient")] pub async fn new_rpc_client() -> Result { + use futures::TryFutureExt; + let ipc_path = mullvad_paths::get_rpc_socket_path(); // The URI will be ignored let channel = Endpoint::from_static("lttp://[::]:50051") .connect_with_connector(service_fn(move |_: Uri| { - IpcEndpoint::connect(ipc_path.clone()) + IpcEndpoint::connect(ipc_path.clone()).map_ok(hyper_util::rt::tokio::TokioIo::new) })) .await .map_err(Error::GrpcTransportError)?; diff --git a/talpid-openvpn-plugin/Cargo.toml b/talpid-openvpn-plugin/Cargo.toml index 6c397ed6c441..ddd029c51754 100644 --- a/talpid-openvpn-plugin/Cargo.toml +++ b/talpid-openvpn-plugin/Cargo.toml @@ -26,6 +26,8 @@ talpid-types = { path = "../talpid-types" } tonic = { workspace = true } tower = { workspace = true } prost = { workspace = true } +hyper-util = { workspace = true } +futures = { workspace = true } [build-dependencies] tonic-build = { workspace = true, default-features = false, features = ["transport", "prost"] } diff --git a/talpid-openvpn-plugin/src/processing.rs b/talpid-openvpn-plugin/src/processing.rs index 8ef6c337e947..cb2a42213845 100644 --- a/talpid-openvpn-plugin/src/processing.rs +++ b/talpid-openvpn-plugin/src/processing.rs @@ -1,11 +1,11 @@ use super::{Arguments, Error}; -use parity_tokio_ipc::Endpoint as IpcEndpoint; use std::collections::HashMap; -use tower::service_fn; - -use tonic::transport::{Endpoint, Uri}; +use futures::TryFutureExt; +use parity_tokio_ipc::Endpoint as IpcEndpoint; use tokio::runtime::{self, Runtime}; +use tonic::transport::{Endpoint, Uri}; +use tower::service_fn; #[allow(clippy::derive_partial_eq_without_eq)] mod proto { @@ -42,7 +42,7 @@ impl EventProcessor { // The URI will be ignored let channel = Endpoint::from_static("lttp://[::]:50051") .connect_with_connector(service_fn(move |_: Uri| { - IpcEndpoint::connect(ipc_path.clone()) + IpcEndpoint::connect(ipc_path.clone()).map_ok(hyper_util::rt::tokio::TokioIo::new) })) .await?; diff --git a/talpid-tunnel-config-client/Cargo.toml b/talpid-tunnel-config-client/Cargo.toml index c2cb5f67347b..e24d8e3fde55 100644 --- a/talpid-tunnel-config-client/Cargo.toml +++ b/talpid-tunnel-config-client/Cargo.toml @@ -17,6 +17,7 @@ talpid-types = { path = "../talpid-types" } tonic = { workspace = true } tower = { workspace = true } prost = { workspace = true } +hyper-util = { workspace = true } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } classic-mceliece-rust = { version = "2.0.0", features = [ "mceliece460896f", diff --git a/talpid-tunnel-config-client/src/lib.rs b/talpid-tunnel-config-client/src/lib.rs index 4172a0023a38..9df62361302e 100644 --- a/talpid-tunnel-config-client/src/lib.rs +++ b/talpid-tunnel-config-client/src/lib.rs @@ -258,9 +258,10 @@ async fn new_client(addr: Ipv4Addr) -> Result { #[cfg(not(target_os = "windows"))] try_set_tcp_sock_mtu(&addr, sock.as_raw_fd(), CONFIG_CLIENT_MTU); - - sock.connect(SocketAddr::new(addr, CONFIG_SERVICE_PORT)) - .await + let stream = sock + .connect(SocketAddr::new(addr, CONFIG_SERVICE_PORT)) + .await?; + Ok::<_, std::io::Error>(hyper_util::rt::tokio::TokioIo::new(stream)) })) .await .map_err(Error::GrpcConnectError)?; diff --git a/test/Cargo.lock b/test/Cargo.lock index 1350b740b5bc..e12e3add158f 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -194,6 +194,12 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.2.0" @@ -202,18 +208,17 @@ checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "axum" -version = "0.6.20" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "itoa", "matchit", "memchr", @@ -222,7 +227,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 1.0.1", "tower", "tower-layer", "tower-service", @@ -230,17 +235,20 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.4" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +checksum = "5e6b8ba012a258d63c9adfa28b9ddcf66149da6f986c5b5452e629d5ee64bf00" dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", "mime", + "pin-project-lite", "rustversion", + "sync_wrapper 1.0.1", "tower-layer", "tower-service", ] @@ -1146,7 +1154,26 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", "indexmap 2.2.6", "slab", "tokio", @@ -1275,6 +1302,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.6" @@ -1282,7 +1320,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", - "http", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -1314,9 +1375,9 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1328,6 +1389,27 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -1335,8 +1417,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "log", "rustls", "rustls-native-certs", @@ -1347,14 +1429,35 @@ dependencies = [ [[package]] name = "hyper-timeout" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793" dependencies = [ - "hyper", + "hyper 1.4.1", + "hyper-util", "pin-project-lite", "tokio", - "tokio-io-timeout", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", + "pin-project-lite", + "socket2 0.5.6", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -1831,8 +1934,8 @@ dependencies = [ "cbindgen", "chrono", "futures", - "http", - "hyper", + "http 0.2.12", + "hyper 0.14.28", "ipnetwork", "libc", "log", @@ -1867,13 +1970,14 @@ version = "0.0.0" dependencies = [ "chrono", "futures", + "hyper-util", "log", "mullvad-paths", "mullvad-types", "nix 0.23.2", "parity-tokio-ipc", - "prost", - "prost-types", + "prost 0.13.3", + "prost-types 0.13.3", "talpid-types", "thiserror", "tokio", @@ -2411,7 +2515,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0f5d036824e4761737860779c906171497f6d55681139d8312388f8fe398922" dependencies = [ "bytes", - "prost-derive", + "prost-derive 0.12.4", +] + +[[package]] +name = "prost" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +dependencies = [ + "bytes", + "prost-derive 0.13.3", ] [[package]] @@ -2428,8 +2542,8 @@ dependencies = [ "once_cell", "petgraph", "prettyplease", - "prost", - "prost-types", + "prost 0.12.4", + "prost-types 0.12.4", "regex", "syn 2.0.60", "tempfile", @@ -2448,13 +2562,35 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "prost-derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.60", +] + [[package]] name = "prost-types" version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3235c33eb02c1f1e212abdbe34c78b264b038fb58ca612664343271e36e55ffe" dependencies = [ - "prost", + "prost 0.12.4", +] + +[[package]] +name = "prost-types" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4759aa0d3a6232fb8dbdb97b61de2c20047c68aca932c7ed76da9d788508d670" +dependencies = [ + "prost 0.13.3", ] [[package]] @@ -2621,10 +2757,10 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", - "hyper", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", "hyper-rustls", "ipnet", "js-sys", @@ -2638,7 +2774,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-rustls", @@ -3173,6 +3309,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3297,6 +3439,7 @@ dependencies = [ "dirs", "env_logger", "futures", + "hyper-util", "inventory", "ipnetwork", "itertools 0.10.5", @@ -3341,7 +3484,7 @@ dependencies = [ "bytes", "colored", "futures", - "hyper", + "hyper 0.14.28", "hyper-rustls", "log", "rustls-pemfile 0.2.1", @@ -3494,16 +3637,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "tokio-io-timeout" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" -dependencies = [ - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-macros" version = "2.2.0" @@ -3619,23 +3752,26 @@ dependencies = [ [[package]] name = "tonic" -version = "0.10.2" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" +checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.21.7", + "base64 0.22.0", "bytes", - "h2", - "http", - "http-body", - "hyper", + "h2 0.4.6", + "http 1.1.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.4.1", "hyper-timeout", + "hyper-util", "percent-encoding", "pin-project", - "prost", + "prost 0.13.3", + "socket2 0.5.6", "tokio", "tokio-stream", "tower", diff --git a/test/Cargo.toml b/test/Cargo.toml index ed56ad455ba1..d436ee9b1ea0 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -54,11 +54,11 @@ serde_json = "1.0" tokio-serde = { version = "0.8.0", features = ["json"] } # Tonic and related crates -tonic = "0.10.0" +tonic = "0.12.2" tonic-build = { version = "0.10.0", default-features = false } tower = "0.4" -prost = "0.12.0" -prost-types = "0.12.0" +prost = "0.13.3" +prost-types = "0.13.3" tarpc = { version = "0.30", features = ["tokio1", "serde-transport", "serde1"] } # Logging diff --git a/test/test-manager/Cargo.toml b/test/test-manager/Cargo.toml index 7285a9e837e5..3331cb19bb90 100644 --- a/test/test-manager/Cargo.toml +++ b/test/test-manager/Cargo.toml @@ -49,6 +49,7 @@ socks-server = { path = "../socks-server" } env_logger = { workspace = true } tonic = { workspace = true } +hyper-util = "0.1.8" tower = { workspace = true } colored = { workspace = true } diff --git a/test/test-manager/src/mullvad_daemon.rs b/test/test-manager/src/mullvad_daemon.rs index 251ed3d1fe99..b03981347001 100644 --- a/test/test-manager/src/mullvad_daemon.rs +++ b/test/test-manager/src/mullvad_daemon.rs @@ -2,6 +2,7 @@ use std::{io, time::Duration}; use futures::{channel::mpsc, future::BoxFuture, pin_mut, FutureExt, SinkExt, StreamExt}; +use hyper_util::rt::TokioIo; use mullvad_management_interface::{ManagementServiceClient, MullvadProxyClient}; use test_rpc::{ mullvad_daemon::MullvadClientVersion, @@ -16,13 +17,13 @@ const CONVERTER_BUF_SIZE: usize = 16 * 1024; #[derive(Clone)] struct DummyService { - management_channel_provider_tx: mpsc::UnboundedSender, + management_channel_provider_tx: mpsc::UnboundedSender>, } impl Service for DummyService { - type Response = DuplexStream; + type Response = TokioIo; type Error = std::io::Error; - type Future = BoxFuture<'static, Result>; + type Future = BoxFuture<'static, Result, Self::Error>>; fn poll_ready( &mut self, @@ -39,9 +40,9 @@ impl Service for DummyService { Box::pin(async move { notifier_tx - .unbounded_send(channel_in) + .unbounded_send(TokioIo::new(channel_in)) .map_err(|_| io::Error::new(io::ErrorKind::Other, "stream receiver is down"))?; - Ok(channel_out) + Ok(TokioIo::new(channel_out)) }) } } @@ -94,7 +95,7 @@ pub fn new_rpc_client( let mut management_channel_in: DuplexStream = match management_channel_provider_rx.next().await { - Some(channel) => channel, + Some(channel) => TokioIo::into_inner(channel), None => { log::trace!("exiting management interface forward loop"); break;