lint
This commit is contained in:
parent
39eb6ee0da
commit
327ad5425f
@ -3,13 +3,9 @@ use serde::Deserialize;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use tokio::io::{
|
use tokio::io::{
|
||||||
split, AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufReader,
|
AsyncBufReadExt, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt,
|
||||||
};
|
};
|
||||||
use tokio::net::TcpStream;
|
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)]
|
#[derive(Deserialize, Clone)]
|
||||||
struct Config {
|
struct Config {
|
||||||
|
@ -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 username = config.proxy_username.clone().unwrap();
|
||||||
let password = config.proxy_password.clone().unwrap();
|
let password = config.proxy_password.clone().unwrap();
|
||||||
let tcp_stream = if !&username.is_empty() && !password.is_empty() {
|
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,
|
proxy_stream,
|
||||||
server,
|
server,
|
||||||
&username,
|
&username,
|
||||||
&password,
|
&password,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap()
|
||||||
tcp_stream
|
|
||||||
} else {
|
} else {
|
||||||
let tcp_stream = Socks5Stream::connect_with_socket(proxy_stream, server)
|
|
||||||
|
Socks5Stream::connect_with_socket(proxy_stream, server)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap()
|
||||||
tcp_stream
|
|
||||||
};
|
};
|
||||||
let tcp_stream = tcp_stream.into_inner();
|
let tcp_stream = tcp_stream.into_inner();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user