Skip to content

How can I use socks5 proxy #1012

Answered by kazk
Masber asked this question in Q&A
Sep 19, 2022 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Proxies are not supported out of the box at the moment. I was experimenting with it a while ago, but haven't had the time to finish (#837).

For SOCKS5, you should be able to do something like this with a custom client with hyper-socks2:

let mut config = Config::infer().await?;
let connector = {
    let mut http = HttpConnector::new();
    http.enforce_http(false);
    let proxy = hyper_socks2::SocksConnector {
        proxy_addr: Uri::from_static("socks5://localhost:5000"),
        auth: None,
        connector: http,
    };
    let tls = tokio_native_tls::TlsConnector::from(config.native_tls_connector()?);
    hyper_tls::HttpsConnector::from((proxy, tls))
};
let service = ServiceBuilder::n…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@njust
Comment options

@clux
Comment options

Answer selected by Masber
Comment options

You must be logged in to vote
1 reply
@kazk
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants