Skip to content

Commit

Permalink
Merge pull request #4 from arloor/feature/support-rust-http-proxy
Browse files Browse the repository at this point in the history
chore: Refactor local/utils.rs for better readability and maintainabi…
  • Loading branch information
arloor authored Sep 5, 2024
2 parents 774c218 + 14bbee7 commit a194ff7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions crates/shadowsocks-service/src/local/utils.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
//! Shadowsocks Local Utilities
use std::{io, net::SocketAddr, time::Duration};
use std::{io, net::SocketAddr};

use log::{debug, trace};
use shadowsocks::{config::ServerConfig, relay::socks5::Address};
use tokio::{
io::{copy_bidirectional, AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt},
time,
};
use tokio::io::{copy_bidirectional, AsyncRead, AsyncWrite};

use crate::local::net::AutoProxyIo;

Expand Down Expand Up @@ -41,6 +38,10 @@ where
// Wait at most 500ms, and then sends handshake packet to remote servers.
#[cfg(not(feature = "https-tunnel"))]
{
use std::time::Duration;
use tokio::io::AsyncReadExt;
use tokio::io::AsyncWriteExt;
use tokio::time;
let mut buffer = [0u8; 8192];
match time::timeout(Duration::from_millis(500), plain.read(&mut buffer)).await {
Ok(Ok(0)) => {
Expand Down

0 comments on commit a194ff7

Please sign in to comment.