This commit is contained in:
sad 2024-10-04 16:28:57 +00:00
parent 39eb6ee0da
commit 327ad5425f
2 changed files with 7 additions and 11 deletions

View File

@ -3,13 +3,9 @@ use serde::Deserialize;
use std::fs;
use std::sync::atomic::{AtomicBool, Ordering};
use tokio::io::{
split, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufReader,
AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt,
};
use tokio::net::TcpStream;
use tokio::sync::mpsc;
use tokio_native_tls::native_tls::TlsConnector as NTlsConnector;
use tokio_native_tls::TlsConnector;
use tokio_socks::tcp::Socks5Stream;
#[derive(Deserialize, Clone)]
struct Config {

View File

@ -16,20 +16,20 @@ pub async fn proxy_exec(config: &Config) -> Result<TcpStream, Box<dyn std::error
let username = config.proxy_username.clone().unwrap();
let password = config.proxy_password.clone().unwrap();
let tcp_stream = if !&username.is_empty() && !password.is_empty() {
let tcp_stream = Socks5Stream::connect_with_password_and_socket(
Socks5Stream::connect_with_password_and_socket(
proxy_stream,
server,
&username,
&password,
)
.await
.unwrap();
tcp_stream
.unwrap()
} else {
let tcp_stream = Socks5Stream::connect_with_socket(proxy_stream, server)
Socks5Stream::connect_with_socket(proxy_stream, server)
.await
.unwrap();
tcp_stream
.unwrap()
};
let tcp_stream = tcp_stream.into_inner();