Skip to content

Commit f7ce9fb

Browse files
committed
嗷嗷
1 parent 6f2f0f8 commit f7ce9fb

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

crates/shadowsocks-service/src/local/http/http_client.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//! HTTP Client
22
3+
#[cfg(not(feature = "https-tunnel"))]
4+
use http::{Method as HttpMethod, Uri, Version as HttpVersion};
35
use std::{
46
borrow::Cow,
57
collections::VecDeque,
@@ -12,7 +14,7 @@ use std::{
1214
time::{Duration, Instant},
1315
};
1416

15-
use http::{HeaderValue, Method as HttpMethod, Uri, Version as HttpVersion, header::InvalidHeaderValue};
17+
use http::{HeaderValue, header::InvalidHeaderValue};
1618
use hyper::{
1719
Request, Response,
1820
body::{self, Body},

crates/shadowsocks-service/src/local/net/tcp/auto_proxy_stream.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ pub enum AutoProxyClientStream {
3636
#[cfg(feature = "https-tunnel")]
3737
use {
3838
bytes::{BufMut, BytesMut},
39-
httparse::{Response, Status},
4039
log::warn,
4140
rustls_native_certs::CertificateResult,
4241
std::io::ErrorKind,
4342
std::sync::LazyLock,
44-
tokio::io::{AsyncReadExt, AsyncWriteExt},
43+
tokio::io::AsyncWriteExt,
4544
tokio_rustls::{
4645
TlsConnector,
4746
rustls::{ClientConfig, RootCertStore, pki_types::ServerName},

crates/shadowsocks-service/src/local/utils.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,8 @@
33
use std::{io, net::SocketAddr};
44

55
use log::{debug, trace};
6-
use shadowsocks::{
7-
config::ServerConfig,
8-
relay::{socks5::Address, tcprelay::utils::copy_encrypted_bidirectional},
9-
};
10-
use tokio::{
11-
io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, copy_bidirectional},
12-
time,
13-
};
6+
use shadowsocks::{config::ServerConfig, relay::socks5::Address};
7+
use tokio::io::{AsyncRead, AsyncWrite, copy_bidirectional};
148

159
use crate::local::net::AutoProxyIo;
1610

@@ -73,8 +67,9 @@ where
7367
#[cfg(feature = "https-tunnel")]
7468
let result = copy_bidirectional(shadow, plain).await;
7569
#[cfg(not(feature = "https-tunnel"))]
76-
let result =
77-
shadowsocks::relay::tcprelay::utils::copy_encrypted_bidirectional(svr_cfg.method(), shadow, plain).await;
70+
use shadowsocks::relay::tcprelay::utils::copy_encrypted_bidirectional;
71+
#[cfg(not(feature = "https-tunnel"))]
72+
let result = copy_encrypted_bidirectional(svr_cfg.method(), shadow, plain).await;
7873
match result {
7974
Ok((wn, rn)) => {
8075
trace!(

crates/shadowsocks/src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ use base64::Engine as _;
1515
use byte_string::ByteStr;
1616
use bytes::Bytes;
1717
use cfg_if::cfg_if;
18-
use log::{error, warn};
18+
use log::error;
19+
#[cfg(not(feature = "https-tunnel"))]
20+
use log::warn;
1921
use thiserror::Error;
2022
use url::{self, Url};
2123

0 commit comments

Comments
 (0)