client: Implement Socks identification and authorization (#29591)
Closes #28792 supersedes #28854 - Adds support for Socks V4 Identification using a userid, and Authorization using a username and password on Socks V5. - Added tests for parsing various Socks proxy urls. - Added a test for making sure a misconfigured socks proxy url doesn't expose the user by connecting directly as a fallback. Release Notes: - Added support for identification and authorization when using a sock proxy
This commit is contained in:
parent
da3a696a60
commit
6b37646179
2 changed files with 158 additions and 46 deletions
|
@ -47,6 +47,7 @@ use std::{
|
|||
};
|
||||
use telemetry::Telemetry;
|
||||
use thiserror::Error;
|
||||
use tokio::net::TcpStream;
|
||||
use url::Url;
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
|
||||
|
@ -1127,7 +1128,10 @@ impl Client {
|
|||
let stream = {
|
||||
let handle = cx.update(|cx| gpui_tokio::Tokio::handle(cx)).ok().unwrap();
|
||||
let _guard = handle.enter();
|
||||
connect_socks_proxy_stream(proxy.as_ref(), rpc_host).await?
|
||||
match proxy {
|
||||
Some(proxy) => connect_socks_proxy_stream(&proxy, rpc_host).await?,
|
||||
None => Box::new(TcpStream::connect(rpc_host).await?),
|
||||
}
|
||||
};
|
||||
|
||||
log::info!("connected to rpc endpoint {}", rpc_url);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue