Skip to content

feat(client): Add system proxy support for macOS #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: proxy-env
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ repository = "https://github.com/hyperium/hyper-util"
license = "MIT"
authors = ["Sean McArthur <sean@seanmonstar.com>"]
keywords = ["http", "hyper", "hyperium"]
categories = ["network-programming", "web-programming::http-client", "web-programming::http-server"]
categories = [
"network-programming",
"web-programming::http-client",
"web-programming::http-server",
]
edition = "2021"
rust-version = "1.63"

Expand All @@ -18,18 +22,30 @@ features = ["full"]
rustdoc-args = ["--cfg", "docsrs"]

[dependencies]
hyper = "1.4.0"
base64 = { version = "0.22", optional = true }
bytes = "1.7.1"
futures-channel = { version = "0.3", optional = true }
futures-util = { version = "0.3.16", default-features = false }
http = "1.0"
http-body = "1.0.0"
bytes = "1.7.1"
hyper = "1.4.0"
ipnet = { version = "2.9", optional = true }
percent-encoding = { version = "2.3", optional = true }
pin-project-lite = "0.2.4"
futures-channel = { version = "0.3", optional = true }
socket2 = { version = "0.5", optional = true, features = ["all"] }
tracing = { version = "0.1", default-features = false, features = ["std"], optional = true }
tokio = { version = "1", optional = true, default-features = false }
tracing = { version = "0.1", default-features = false, features = [
"std",
], optional = true }
tokio = { version = "1", optional = true, default-features = false }
tower-service = { version = "0.3", optional = true }

# Conditional dependencies for system proxy support
[target.'cfg(target_os = "macos")'.dependencies]
system-configuration = { version = "0.6.1", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
winreg = { version = "0.55.0", optional = true }

[dev-dependencies]
hyper = { version = "1.4.0", features = ["full"] }
bytes = "1"
Expand All @@ -42,7 +58,7 @@ pretty_env_logger = "0.5"
pnet_datalink = "0.35.0"

[features]
default = []
default = ["client-proxy-env"]

# Shorthand to enable everything
full = [
Expand All @@ -55,10 +71,17 @@ full = [
"http1",
"http2",
"tokio",
"system-proxies"
]

client = ["hyper/client", "dep:tracing", "dep:futures-channel", "dep:tower-service"]
client = [
"hyper/client",
"dep:tracing",
"dep:futures-channel",
"dep:tower-service",
]
client-legacy = ["client", "dep:socket2", "tokio/sync"]
client-proxy-env = ["client", "dep:base64", "dep:ipnet", "dep:percent-encoding"]

server = ["hyper/server"]
server-auto = ["server", "http1", "http2"]
Expand All @@ -71,6 +94,8 @@ http2 = ["hyper/http2"]

tokio = ["dep:tokio", "tokio/net", "tokio/rt", "tokio/time"]

system-proxies = ["system-configuration", "winreg"]

# internal features used in CI
__internal_happy_eyeballs_tests = []

Expand Down
4 changes: 4 additions & 0 deletions src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
/// Legacy implementations of `connect` module and `Client`
#[cfg(feature = "client-legacy")]
pub mod legacy;

// for now, no others features use this mod
//#[cfg(feature = "client-proxy-env")]
pub mod proxy;
Loading