Fix socks5 proxy support (#629)

This commit is contained in:
Sheldon 2021-12-31 05:19:34 -05:00 committed by GitHub
parent 34d23eb17a
commit 4c81e4a693
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -164,7 +164,7 @@ impl HttpSlateSender {
IN: Serialize, IN: Serialize,
{ {
let client = let client =
if self.use_socks { if !self.use_socks {
Client::new() Client::new()
} else { } else {
Client::with_socks_proxy(self.socks_proxy_addr.ok_or_else(|| { Client::with_socks_proxy(self.socks_proxy_addr.ok_or_else(|| {

View file

@ -125,7 +125,7 @@ impl Client {
.default_headers(headers); .default_headers(headers);
if let Some(s) = socks_proxy_addr { if let Some(s) = socks_proxy_addr {
let proxy = Proxy::all(&format!("socks5://{}:{}", s.ip(), s.port())) let proxy = Proxy::all(&format!("socks5h://{}:{}", s.ip(), s.port()))
.map_err(|e| ErrorKind::Internal(format!("Unable to create proxy: {}", e)))?; .map_err(|e| ErrorKind::Internal(format!("Unable to create proxy: {}", e)))?;
builder = builder.proxy(proxy); builder = builder.proxy(proxy);
} }