summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSebastian Holmin <sebastian.holmin@mullvad.net>2024-09-26 09:05:36 +0200
committerSebastian Holmin <sebastian.holmin@mullvad.net>2024-09-26 09:05:36 +0200
commit8de2c04342520dbedad63c83752a9d355bd60165 (patch)
treeb786d28672469cfcf8ef1442e4bd7a87abd46f53
parentd75f793ed898835e00f5ff08a259f5f64662b07f (diff)
parent6864a62453151886c24c59aa2750db91871a13a3 (diff)
downloadmullvadvpn-8de2c04342520dbedad63c83752a9d355bd60165.tar.xz
mullvadvpn-8de2c04342520dbedad63c83752a9d355bd60165.zip
Merge branch 'upgrade-to-hyper-1-des-1207'
-rw-r--r--test/Cargo.lock172
-rw-r--r--test/Cargo.toml1
-rw-r--r--test/test-manager/Cargo.toml2
-rw-r--r--test/test-rpc/Cargo.toml10
-rw-r--r--test/test-rpc/src/net.rs36
5 files changed, 126 insertions, 95 deletions
diff --git a/test/Cargo.lock b/test/Cargo.lock
index e12e3add15..626d0ff62f 100644
--- a/test/Cargo.lock
+++ b/test/Cargo.lock
@@ -276,12 +276,6 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
[[package]]
name = "base64"
-version = "0.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8"
-
-[[package]]
-name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
@@ -386,9 +380,12 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.95"
+version = "1.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b"
+checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0"
+dependencies = [
+ "shlex",
+]
[[package]]
name = "cesu8"
@@ -1419,12 +1416,28 @@ dependencies = [
"futures-util",
"http 0.2.12",
"hyper 0.14.28",
+ "rustls 0.21.11",
+ "tokio",
+ "tokio-rustls 0.24.1",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.27.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
+dependencies = [
+ "futures-util",
+ "http 1.1.0",
+ "hyper 1.4.1",
+ "hyper-util",
"log",
- "rustls",
- "rustls-native-certs",
+ "rustls 0.23.13",
+ "rustls-pki-types",
"tokio",
- "tokio-rustls",
- "webpki-roots",
+ "tokio-rustls 0.26.0",
+ "tower-service",
+ "webpki-roots 0.26.6",
]
[[package]]
@@ -1949,7 +1962,7 @@ dependencies = [
"talpid-types",
"thiserror",
"tokio",
- "tokio-rustls",
+ "tokio-rustls 0.24.1",
"tokio-socks",
"uuid",
]
@@ -2166,12 +2179,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
-name = "openssl-probe"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
-
-[[package]]
name = "openssl-sys"
version = "0.9.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2761,7 +2768,7 @@ dependencies = [
"http 0.2.12",
"http-body 0.4.6",
"hyper 0.14.28",
- "hyper-rustls",
+ "hyper-rustls 0.24.2",
"ipnet",
"js-sys",
"log",
@@ -2769,7 +2776,7 @@ dependencies = [
"once_cell",
"percent-encoding",
"pin-project-lite",
- "rustls",
+ "rustls 0.21.11",
"rustls-pemfile 1.0.4",
"serde",
"serde_json",
@@ -2777,13 +2784,13 @@ dependencies = [
"sync_wrapper 0.1.2",
"system-configuration",
"tokio",
- "tokio-rustls",
+ "tokio-rustls 0.24.1",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots",
+ "webpki-roots 0.25.4",
"winreg",
]
@@ -2873,41 +2880,51 @@ checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
dependencies = [
"log",
"ring",
- "rustls-webpki",
+ "rustls-webpki 0.101.7",
"sct",
]
[[package]]
-name = "rustls-native-certs"
-version = "0.6.3"
+name = "rustls"
+version = "0.23.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
+checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8"
dependencies = [
- "openssl-probe",
- "rustls-pemfile 1.0.4",
- "schannel",
- "security-framework",
+ "log",
+ "once_cell",
+ "ring",
+ "rustls-pki-types",
+ "rustls-webpki 0.102.8",
+ "subtle",
+ "zeroize",
]
[[package]]
name = "rustls-pemfile"
-version = "0.2.1"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9"
+checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
- "base64 0.13.1",
+ "base64 0.21.7",
]
[[package]]
name = "rustls-pemfile"
-version = "1.0.4"
+version = "2.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
+checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425"
dependencies = [
- "base64 0.21.7",
+ "base64 0.22.0",
+ "rustls-pki-types",
]
[[package]]
+name = "rustls-pki-types"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"
+
+[[package]]
name = "rustls-webpki"
version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2918,6 +2935,17 @@ dependencies = [
]
[[package]]
+name = "rustls-webpki"
+version = "0.102.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
+dependencies = [
+ "ring",
+ "rustls-pki-types",
+ "untrusted",
+]
+
+[[package]]
name = "rustversion"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2939,15 +2967,6 @@ dependencies = [
]
[[package]]
-name = "schannel"
-version = "0.1.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
-dependencies = [
- "windows-sys 0.52.0",
-]
-
-[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2977,29 +2996,6 @@ dependencies = [
]
[[package]]
-name = "security-framework"
-version = "2.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "core-foundation-sys",
- "libc",
- "security-framework-sys",
-]
-
-[[package]]
-name = "security-framework-sys"
-version = "2.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
-[[package]]
name = "semver"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3153,6 +3149,12 @@ dependencies = [
]
[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
name = "signal-hook-registry"
version = "1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3484,16 +3486,18 @@ dependencies = [
"bytes",
"colored",
"futures",
- "hyper 0.14.28",
- "hyper-rustls",
+ "http-body-util",
+ "hyper 1.4.1",
+ "hyper-rustls 0.27.3",
+ "hyper-util",
"log",
- "rustls-pemfile 0.2.1",
+ "rustls-pemfile 2.1.3",
"serde",
"serde_json",
"tarpc",
"thiserror",
"tokio",
- "tokio-rustls",
+ "tokio-rustls 0.26.0",
"tokio-serde",
"tokio-util",
]
@@ -3654,7 +3658,18 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
- "rustls",
+ "rustls 0.21.11",
+ "tokio",
+]
+
+[[package]]
+name = "tokio-rustls"
+version = "0.26.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
+dependencies = [
+ "rustls 0.23.13",
+ "rustls-pki-types",
"tokio",
]
@@ -4120,6 +4135,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
[[package]]
+name = "webpki-roots"
+version = "0.26.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958"
+dependencies = [
+ "rustls-pki-types",
+]
+
+[[package]]
name = "widestring"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/test/Cargo.toml b/test/Cargo.toml
index d436ee9b1e..fd50761e7e 100644
--- a/test/Cargo.toml
+++ b/test/Cargo.toml
@@ -60,6 +60,7 @@ tower = "0.4"
prost = "0.13.3"
prost-types = "0.13.3"
tarpc = { version = "0.30", features = ["tokio1", "serde-transport", "serde1"] }
+hyper-util = {version = "0.1.8", features = ["client", "client-legacy", "http2"]}
# Logging
env_logger = "0.11.0"
diff --git a/test/test-manager/Cargo.toml b/test/test-manager/Cargo.toml
index 3331cb19bb..80c8170635 100644
--- a/test/test-manager/Cargo.toml
+++ b/test/test-manager/Cargo.toml
@@ -49,7 +49,7 @@ socks-server = { path = "../socks-server" }
env_logger = { workspace = true }
tonic = { workspace = true }
-hyper-util = "0.1.8"
+hyper-util = { workspace = true }
tower = { workspace = true }
colored = { workspace = true }
diff --git a/test/test-rpc/Cargo.toml b/test/test-rpc/Cargo.toml
index c39a2a1975..12172e45ec 100644
--- a/test/test-rpc/Cargo.toml
+++ b/test/test-rpc/Cargo.toml
@@ -23,10 +23,12 @@ log = { workspace = true }
colored = { workspace = true }
async-trait = { workspace = true }
-hyper = { version = "0.14.23", features = ["client", "http2"] }
-hyper-rustls = { version = "0.24", features = ["log", "webpki-roots"] }
-tokio-rustls = "0.24"
-rustls-pemfile = "0.2"
+hyper = { version = "1.4.1", features = ["client", "http2"] }
+hyper-rustls = { version = "0.27.3", features = ["logging", "webpki-roots", "http1", "ring"], default-features = false}
+hyper-util = {workspace = true}
+http-body-util = "0.1.2"
+tokio-rustls = { version = "0.26.0", features = ["logging", "tls12", "ring"], default-features = false}
+rustls-pemfile = "2.1.3"
[dependencies.tokio-util]
version = "0.7"
diff --git a/test/test-rpc/src/net.rs b/test/test-rpc/src/net.rs
index c867ccf0d0..4f79aca8d5 100644
--- a/test/test-rpc/src/net.rs
+++ b/test/test-rpc/src/net.rs
@@ -1,19 +1,17 @@
+use crate::{AmIMullvad, Error};
+use bytes::Bytes;
use futures::channel::oneshot;
-use hyper::{Client, Uri};
+use http_body_util::{BodyExt, Full};
+use hyper::Uri;
+use hyper_util::client::legacy::Client;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{net::SocketAddr, sync::LazyLock, time::Duration};
-use tokio_rustls::rustls::ClientConfig;
-
-use crate::{AmIMullvad, Error};
+use tokio_rustls::rustls::{self, ClientConfig};
const LE_ROOT_CERT: &[u8] = include_bytes!("../../../mullvad-api/le_root_cert.pem");
static CLIENT_CONFIG: LazyLock<ClientConfig> = LazyLock::new(|| {
ClientConfig::builder()
- .with_safe_default_cipher_suites()
- .with_safe_default_kx_groups()
- .with_safe_default_protocol_versions()
- .unwrap()
.with_root_certificates(read_cert_store())
.with_no_client_auth()
});
@@ -86,7 +84,8 @@ pub async fn http_get<T: DeserializeOwned>(url: Uri) -> Result<T, Error> {
.enable_http1()
.build();
- let client: Client<_, hyper::Body> = Client::builder().build(https);
+ let client: Client<_, Full<Bytes>> =
+ Client::builder(hyper_util::rt::TokioExecutor::new()).build(https);
let body = client
.get(url)
.await
@@ -94,10 +93,14 @@ pub async fn http_get<T: DeserializeOwned>(url: Uri) -> Result<T, Error> {
.into_body();
// TODO: limit length
- let bytes = hyper::body::to_bytes(body).await.map_err(|error| {
- log::error!("Failed to convert body to bytes buffer: {}", error);
- Error::DeserializeBody
- })?;
+ let bytes = body
+ .collect()
+ .await
+ .map_err(|error| {
+ log::error!("Failed to collect response body: {}", error);
+ Error::DeserializeBody
+ })?
+ .to_bytes();
serde_json::from_slice(&bytes).map_err(|error| {
log::error!("Failed to deserialize response: {}", error);
@@ -114,12 +117,13 @@ pub async fn http_get_with_timeout<T: DeserializeOwned>(
.map_err(|_| Error::HttpRequest("Request timed out".into()))?
}
-fn read_cert_store() -> tokio_rustls::rustls::RootCertStore {
- let mut cert_store = tokio_rustls::rustls::RootCertStore::empty();
+fn read_cert_store() -> rustls::RootCertStore {
+ let mut cert_store = rustls::RootCertStore::empty();
let certs = rustls_pemfile::certs(&mut std::io::BufReader::new(LE_ROOT_CERT))
+ .collect::<Result<Vec<_>, _>>()
.expect("Failed to parse pem file");
- let (num_certs_added, num_failures) = cert_store.add_parsable_certificates(&certs);
+ let (num_certs_added, num_failures) = cert_store.add_parsable_certificates(certs);
if num_failures > 0 || num_certs_added != 1 {
panic!("Failed to add root cert");
}