Conversation
…ccess point connection
2 tasks
VIIII4
force-pushed
the
socks5-proxy-support
branch
from
September 23, 2026 02:35
7dc0f42 to
f7b862e
Compare
VIIII4
force-pushed
the
socks5-proxy-support
branch
from
September 23, 2026 02:40
f7b862e to
cebe05f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds SOCKS5 proxy support (and proxy authentication, which was missing
entirely) to both network paths that use
SessionConfig::proxy:socket.rs): previously every proxy URL wastreated as an HTTP CONNECT proxy regardless of its scheme, and no
Proxy-Authorizationheader was ever sent, so authenticated proxiesanswered
407;http_client.rs): previously built onhyper-proxy2, which supports neither SOCKS nor proxy authentication.What is supported after this PR
http://host:portProxy-Authorization: Basicif credentials are presenthttps://host:portsocks5://,socks5://user:pass@host:portsocks5hsemantics — resolving Spotify hostnames locally is usually exactly what SOCKS users want to avoid)socks5h://,socks://socks5://socks4://,socks4a://Both the access point tunnel and the spclient HTTP client share the same
handling. SOCKS5 credentials use RFC 1929 username/password authentication.
The new
proxy_connector.rsimplements aService<Uri>that replaceshyper-proxy2for the HTTP client, layering TLS (native-tls or rustls,whichever feature is selected) on top of the tunnel for https destinations.
No new external crates are required: the SOCKS5 handshake (RFC 1928/1929) is
implemented in
proxytunnel.rsin the same style as the existing CONNECTtunnelling, and the TLS crates were already in the dependency tree indirectly.
The vendored-in-spirit summary of the four commits:
core: SOCKS5 + authenticated HTTP CONNECT for the access point connectioncore: unified proxy connector for the HTTP client (replaces hyper-proxy2 usage)oauth: enable reqwest'ssocksfeature so the token exchange honours SOCKS proxy environment variablescore:examples/proxy_check.rsto exercise all three paths against a real proxyTesting
Tested end to end against a local SOCKS5 server (with and without RFC 1929
credentials, upstream-chained through an HTTP proxy) and against a plain
HTTP CONNECT proxy:
The proxy-side log confirms the client sends domain names (ATYP = 0x03) and
never pre-resolved addresses.
cargo clippyandcargo fmt --checkareclean for both TLS backends (
native-tlsandrustls-tls-webpki-roots).Downstream motivation: ncspot currently cannot route all of its traffic
through a SOCKS proxy (hrkfdn/ncspot#898) and fails to log in behind
authenticated proxies (hrkfdn/ncspot#531); a matching ncspot-side change
exposes this as a single configuration option.