From fe4e39a230c1d48c706a031838e76969b43cd2bf Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 18 Sep 2024 11:46:06 -0400 Subject: [PATCH] Add `socks` support (#7503) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This adds about 50 KB to the binary: ``` ❯ du ./target/release/socks 44736 ./target/release/socks ❯ du ./target/release/uv 44632 ./target/release/uv ``` So need some input on whether it's worth supporting. Closes https://github.com/astral-sh/uv/issues/7484. --- Cargo.lock | 13 +++++++++++++ Cargo.toml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 30373f056..fdfda7eba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3118,6 +3118,7 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-rustls", + "tokio-socks", "tokio-util", "tower-service", "url", @@ -4091,6 +4092,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-socks" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d4770b8024672c1101b3f6733eab95b18007dbe0847a8afe341fcf79e06043f" +dependencies = [ + "either", + "futures-util", + "thiserror", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.16" diff --git a/Cargo.toml b/Cargo.toml index ad6da60c5..71a468672 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,7 +122,7 @@ quote = { version = "1.0.37" } rayon = { version = "1.10.0" } reflink-copy = { version = "0.1.19" } regex = { version = "1.10.6" } -reqwest = { version = "0.12.7", default-features = false, features = ["json", "gzip", "stream", "rustls-tls", "rustls-tls-native-roots"] } +reqwest = { version = "0.12.7", default-features = false, features = ["json", "gzip", "stream", "rustls-tls", "rustls-tls-native-roots", "socks"] } reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "5e3eaf254b5bd481c75d2710eed055f95b756913" } reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "5e3eaf254b5bd481c75d2710eed055f95b756913" } rkyv = { version = "0.7.45", features = ["strict", "validation"] }