fix some warnings by moving imports around
This commit is contained in:
@@ -2,7 +2,6 @@ use std::io::{Cursor, ErrorKind, Read, Result as IoResult, Write};
|
|||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use std::net::ToSocketAddrs;
|
use std::net::ToSocketAddrs;
|
||||||
use std::thread;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
@@ -10,13 +9,6 @@ use rustls::ClientSession;
|
|||||||
#[cfg(feature = "tls")]
|
#[cfg(feature = "tls")]
|
||||||
use rustls::StreamOwned;
|
use rustls::StreamOwned;
|
||||||
|
|
||||||
#[cfg(feature = "socks-proxy")]
|
|
||||||
use socks::{Socks5Stream, ToTargetAddr};
|
|
||||||
#[cfg(feature = "socks-proxy")]
|
|
||||||
use std::sync::mpsc::channel;
|
|
||||||
#[cfg(feature = "socks-proxy")]
|
|
||||||
use std::sync::{Arc, Condvar, Mutex};
|
|
||||||
|
|
||||||
use crate::proxy::Proto;
|
use crate::proxy::Proto;
|
||||||
use crate::proxy::Proxy;
|
use crate::proxy::Proxy;
|
||||||
|
|
||||||
@@ -294,7 +286,11 @@ fn connect_socks5(
|
|||||||
// # Defects
|
// # Defects
|
||||||
// 1) In the event of a timeout, a thread may be left running in the background.
|
// 1) In the event of a timeout, a thread may be left running in the background.
|
||||||
// TODO: explore supporting timeouts upstream in Socks5Proxy.
|
// TODO: explore supporting timeouts upstream in Socks5Proxy.
|
||||||
|
#[allow(clippy::mutex_atomic)]
|
||||||
let stream = if timeout_connect > 0 {
|
let stream = if timeout_connect > 0 {
|
||||||
|
use std::sync::{Arc, Condvar, Mutex};
|
||||||
|
use std::thread;
|
||||||
|
use std::sync::mpsc::channel;
|
||||||
let master_signal = Arc::new((Mutex::new(false), Condvar::new()));
|
let master_signal = Arc::new((Mutex::new(false), Condvar::new()));
|
||||||
let slave_signal = master_signal.clone();
|
let slave_signal = master_signal.clone();
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
@@ -345,6 +341,7 @@ fn get_socks5_stream(
|
|||||||
proxy_addr: &SocketAddr,
|
proxy_addr: &SocketAddr,
|
||||||
host_addr: &SocketAddr,
|
host_addr: &SocketAddr,
|
||||||
) -> Result<TcpStream, std::io::Error> {
|
) -> Result<TcpStream, std::io::Error> {
|
||||||
|
use socks::{Socks5Stream, ToTargetAddr};
|
||||||
if proxy.use_authorization() {
|
if proxy.use_authorization() {
|
||||||
let stream = Socks5Stream::connect_with_password(
|
let stream = Socks5Stream::connect_with_password(
|
||||||
proxy_addr,
|
proxy_addr,
|
||||||
|
|||||||
Reference in New Issue
Block a user