mirror of
https://github.com/shadowsocks/shadowsocks-rust.git
synced 2026-02-09 01:59:16 +08:00
chore: imports_granularity set to default
- imports_granularity is still unstable since 2021: https://rust-lang.github.io/rustfmt/?version=v1.6.0&search=#imports_granularity
This commit is contained in:
@@ -70,14 +70,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use shadowsocks::relay::socks5::Address;
|
use shadowsocks::relay::socks5::Address;
|
||||||
use shadowsocks::{
|
use shadowsocks::{
|
||||||
config::{
|
config::{
|
||||||
ManagerAddr,
|
ManagerAddr, Mode, ReplayAttackPolicy, ServerAddr, ServerConfig, ServerSource, ServerUser, ServerUserManager,
|
||||||
Mode,
|
|
||||||
ReplayAttackPolicy,
|
|
||||||
ServerAddr,
|
|
||||||
ServerConfig,
|
|
||||||
ServerSource,
|
|
||||||
ServerUser,
|
|
||||||
ServerUserManager,
|
|
||||||
ServerWeight,
|
ServerWeight,
|
||||||
},
|
},
|
||||||
crypto::CipherKind,
|
crypto::CipherKind,
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ use hickory_resolver::proto::{
|
|||||||
op::{header::MessageType, response_code::ResponseCode, Header, Message, OpCode},
|
op::{header::MessageType, response_code::ResponseCode, Header, Message, OpCode},
|
||||||
rr::{
|
rr::{
|
||||||
rdata::{A, AAAA},
|
rdata::{A, AAAA},
|
||||||
DNSClass,
|
DNSClass, RData, Record, RecordType,
|
||||||
RData,
|
|
||||||
Record,
|
|
||||||
RecordType,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use log::{debug, trace};
|
use log::{debug, trace};
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ use hyper::{
|
|||||||
client::conn::{http1, http2},
|
client::conn::{http1, http2},
|
||||||
http::uri::Scheme,
|
http::uri::Scheme,
|
||||||
rt::{Sleep, Timer},
|
rt::{Sleep, Timer},
|
||||||
Request,
|
Request, Response,
|
||||||
Response,
|
|
||||||
};
|
};
|
||||||
use log::{error, trace};
|
use log::{error, trace};
|
||||||
use lru_time_cache::LruCache;
|
use lru_time_cache::LruCache;
|
||||||
|
|||||||
@@ -8,13 +8,7 @@ use hyper::{
|
|||||||
body,
|
body,
|
||||||
header::{self, HeaderValue},
|
header::{self, HeaderValue},
|
||||||
http::uri::{Authority, Scheme},
|
http::uri::{Authority, Scheme},
|
||||||
HeaderMap,
|
HeaderMap, Method, Request, Response, StatusCode, Uri, Version,
|
||||||
Method,
|
|
||||||
Request,
|
|
||||||
Response,
|
|
||||||
StatusCode,
|
|
||||||
Uri,
|
|
||||||
Version,
|
|
||||||
};
|
};
|
||||||
use log::{debug, error, trace};
|
use log::{debug, error, trace};
|
||||||
use shadowsocks::relay::Address;
|
use shadowsocks::relay::Address;
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ use tokio::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::local::{
|
use crate::local::{
|
||||||
context::ServiceContext,
|
context::ServiceContext, loadbalancing::PingBalancer, net::tcp::listener::create_standard_tcp_listener,
|
||||||
loadbalancing::PingBalancer,
|
|
||||||
net::tcp::listener::create_standard_tcp_listener,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{http_client::HttpClient, http_service::HttpService, tokio_rt::TokioIo};
|
use super::{http_client::HttpClient, http_service::HttpService, tokio_rt::TokioIo};
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ use std::{
|
|||||||
use hyper::{
|
use hyper::{
|
||||||
header::{self, HeaderValue},
|
header::{self, HeaderValue},
|
||||||
http::uri::Authority,
|
http::uri::Authority,
|
||||||
HeaderMap,
|
HeaderMap, Uri, Version,
|
||||||
Uri,
|
|
||||||
Version,
|
|
||||||
};
|
};
|
||||||
use log::error;
|
use log::error;
|
||||||
use shadowsocks::relay::socks5::Address;
|
use shadowsocks::relay::socks5::Address;
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ use shadowsocks::{
|
|||||||
use crate::{
|
use crate::{
|
||||||
local::{context::ServiceContext, loadbalancing::PingBalancer},
|
local::{context::ServiceContext, loadbalancing::PingBalancer},
|
||||||
net::{
|
net::{
|
||||||
packet_window::PacketWindowFilter,
|
packet_window::PacketWindowFilter, MonProxySocket, UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||||
MonProxySocket,
|
|
||||||
UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
|
||||||
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,15 +9,7 @@ use std::{
|
|||||||
use log::trace;
|
use log::trace;
|
||||||
use pin_project::pin_project;
|
use pin_project::pin_project;
|
||||||
use shadowsocks::relay::socks5::{
|
use shadowsocks::relay::socks5::{
|
||||||
self,
|
self, Address, Command, Error, HandshakeRequest, HandshakeResponse, Reply, TcpRequestHeader, TcpResponseHeader,
|
||||||
Address,
|
|
||||||
Command,
|
|
||||||
Error,
|
|
||||||
HandshakeRequest,
|
|
||||||
HandshakeResponse,
|
|
||||||
Reply,
|
|
||||||
TcpRequestHeader,
|
|
||||||
TcpResponseHeader,
|
|
||||||
};
|
};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncRead, AsyncWrite, ReadBuf},
|
io::{AsyncRead, AsyncWrite, ReadBuf},
|
||||||
|
|||||||
@@ -7,9 +7,7 @@ use tokio::{net::TcpStream, time};
|
|||||||
#[cfg(feature = "local-http")]
|
#[cfg(feature = "local-http")]
|
||||||
use crate::local::http::HttpConnectionHandler;
|
use crate::local::http::HttpConnectionHandler;
|
||||||
use crate::local::{
|
use crate::local::{
|
||||||
context::ServiceContext,
|
context::ServiceContext, loadbalancing::PingBalancer, net::tcp::listener::create_standard_tcp_listener,
|
||||||
loadbalancing::PingBalancer,
|
|
||||||
net::tcp::listener::create_standard_tcp_listener,
|
|
||||||
socks::config::Socks5AuthConfig,
|
socks::config::Socks5AuthConfig,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,7 @@ use crate::local::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::local::socks::socks4::{
|
use crate::local::socks::socks4::{
|
||||||
Address,
|
Address, Command, Error as Socks4Error, HandshakeRequest, HandshakeResponse, ResultCode,
|
||||||
Command,
|
|
||||||
Error as Socks4Error,
|
|
||||||
HandshakeRequest,
|
|
||||||
HandshakeResponse,
|
|
||||||
ResultCode,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct Socks4TcpHandler {
|
pub struct Socks4TcpHandler {
|
||||||
|
|||||||
@@ -11,17 +11,8 @@ use log::{debug, error, trace, warn};
|
|||||||
use shadowsocks::{
|
use shadowsocks::{
|
||||||
config::Mode,
|
config::Mode,
|
||||||
relay::socks5::{
|
relay::socks5::{
|
||||||
self,
|
self, Address, Command, Error as Socks5Error, HandshakeRequest, HandshakeResponse, PasswdAuthRequest,
|
||||||
Address,
|
PasswdAuthResponse, Reply, TcpRequestHeader, TcpResponseHeader,
|
||||||
Command,
|
|
||||||
Error as Socks5Error,
|
|
||||||
HandshakeRequest,
|
|
||||||
HandshakeResponse,
|
|
||||||
PasswdAuthRequest,
|
|
||||||
PasswdAuthResponse,
|
|
||||||
Reply,
|
|
||||||
TcpRequestHeader,
|
|
||||||
TcpResponseHeader,
|
|
||||||
},
|
},
|
||||||
ServerAddr,
|
ServerAddr,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,23 +13,13 @@ use shadowsocks::{
|
|||||||
manager::{
|
manager::{
|
||||||
datagram::ManagerSocketAddr,
|
datagram::ManagerSocketAddr,
|
||||||
protocol::{
|
protocol::{
|
||||||
self,
|
self, AddRequest, AddResponse, ErrorResponse, ListResponse, ManagerRequest, PingResponse, RemoveRequest,
|
||||||
AddRequest,
|
RemoveResponse, ServerUserConfig, StatRequest,
|
||||||
AddResponse,
|
|
||||||
ErrorResponse,
|
|
||||||
ListResponse,
|
|
||||||
ManagerRequest,
|
|
||||||
PingResponse,
|
|
||||||
RemoveRequest,
|
|
||||||
RemoveResponse,
|
|
||||||
ServerUserConfig,
|
|
||||||
StatRequest,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
net::{AcceptOpts, ConnectOpts},
|
net::{AcceptOpts, ConnectOpts},
|
||||||
plugin::PluginConfig,
|
plugin::PluginConfig,
|
||||||
ManagerListener,
|
ManagerListener, ServerAddr,
|
||||||
ServerAddr,
|
|
||||||
};
|
};
|
||||||
use tokio::{sync::Mutex, task::JoinHandle};
|
use tokio::{sync::Mutex, task::JoinHandle};
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ use shadowsocks::{
|
|||||||
crypto::CipherKind,
|
crypto::CipherKind,
|
||||||
net::{AcceptOpts, TcpStream as OutboundTcpStream},
|
net::{AcceptOpts, TcpStream as OutboundTcpStream},
|
||||||
relay::tcprelay::{utils::copy_encrypted_bidirectional, ProxyServerStream},
|
relay::tcprelay::{utils::copy_encrypted_bidirectional, ProxyServerStream},
|
||||||
ProxyListener,
|
ProxyListener, ServerConfig,
|
||||||
ServerConfig,
|
|
||||||
};
|
};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncReadExt, AsyncWriteExt},
|
io::{AsyncReadExt, AsyncWriteExt},
|
||||||
|
|||||||
@@ -29,10 +29,7 @@ use tokio::{runtime::Handle, sync::mpsc, task::JoinHandle, time};
|
|||||||
use windows_sys::Win32::Networking::WinSock::WSAEAFNOSUPPORT;
|
use windows_sys::Win32::Networking::WinSock::WSAEAFNOSUPPORT;
|
||||||
|
|
||||||
use crate::net::{
|
use crate::net::{
|
||||||
packet_window::PacketWindowFilter,
|
packet_window::PacketWindowFilter, utils::to_ipv4_mapped, MonProxySocket, UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
||||||
utils::to_ipv4_mapped,
|
|
||||||
MonProxySocket,
|
|
||||||
UDP_ASSOCIATION_KEEP_ALIVE_CHANNEL_SIZE,
|
|
||||||
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
UDP_ASSOCIATION_SEND_CHANNEL_SIZE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ use hickory_resolver::{
|
|||||||
udp::{DnsUdpSocket, QuicLocalAddr},
|
udp::{DnsUdpSocket, QuicLocalAddr},
|
||||||
TokioTime,
|
TokioTime,
|
||||||
},
|
},
|
||||||
AsyncResolver,
|
AsyncResolver, TokioHandle,
|
||||||
TokioHandle,
|
|
||||||
};
|
};
|
||||||
use log::trace;
|
use log::trace;
|
||||||
use tokio::{io::ReadBuf, net::UdpSocket};
|
use tokio::{io::ReadBuf, net::UdpSocket};
|
||||||
|
|||||||
@@ -8,16 +8,8 @@ use super::{
|
|||||||
datagram::ManagerDatagram,
|
datagram::ManagerDatagram,
|
||||||
error::Error,
|
error::Error,
|
||||||
protocol::{
|
protocol::{
|
||||||
AddRequest,
|
AddRequest, AddResponse, ListRequest, ListResponse, ManagerProtocol, PingRequest, PingResponse, RemoveRequest,
|
||||||
AddResponse,
|
RemoveResponse, StatRequest,
|
||||||
ListRequest,
|
|
||||||
ListResponse,
|
|
||||||
ManagerProtocol,
|
|
||||||
PingRequest,
|
|
||||||
PingResponse,
|
|
||||||
RemoveRequest,
|
|
||||||
RemoveResponse,
|
|
||||||
StatRequest,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
io,
|
io, mem,
|
||||||
mem,
|
|
||||||
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
||||||
os::unix::io::{AsRawFd, RawFd},
|
os::unix::io::{AsRawFd, RawFd},
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
@@ -21,9 +20,7 @@ use tokio_tfo::TfoStream;
|
|||||||
use crate::net::{
|
use crate::net::{
|
||||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||||
udp::{BatchRecvMessage, BatchSendMessage},
|
udp::{BatchRecvMessage, BatchSendMessage},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ use tokio_tfo::TfoStream;
|
|||||||
use crate::net::{
|
use crate::net::{
|
||||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||||
udp::{BatchRecvMessage, BatchSendMessage},
|
udp::{BatchRecvMessage, BatchSendMessage},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
io,
|
io, mem,
|
||||||
mem,
|
|
||||||
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr},
|
||||||
os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
|
os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd},
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
@@ -22,9 +21,7 @@ use tokio_tfo::TfoStream;
|
|||||||
use crate::net::{
|
use crate::net::{
|
||||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||||
udp::{BatchRecvMessage, BatchSendMessage},
|
udp::{BatchRecvMessage, BatchSendMessage},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ use tokio::{
|
|||||||
|
|
||||||
use crate::net::{
|
use crate::net::{
|
||||||
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, ErrorKind},
|
sys::{set_common_sockopt_after_connect, set_common_sockopt_for_connect, ErrorKind},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A wrapper of `TcpStream`
|
/// A wrapper of `TcpStream`
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ use std::{
|
|||||||
io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket},
|
io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket},
|
||||||
},
|
},
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
ptr,
|
ptr, slice,
|
||||||
slice,
|
|
||||||
task::{self, Poll},
|
task::{self, Poll},
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
@@ -30,32 +29,13 @@ use windows_sys::{
|
|||||||
Win32::{
|
Win32::{
|
||||||
Foundation::{BOOL, ERROR_BUFFER_OVERFLOW, ERROR_NO_DATA, ERROR_SUCCESS},
|
Foundation::{BOOL, ERROR_BUFFER_OVERFLOW, ERROR_NO_DATA, ERROR_SUCCESS},
|
||||||
NetworkManagement::IpHelper::{
|
NetworkManagement::IpHelper::{
|
||||||
if_nametoindex,
|
if_nametoindex, GetAdaptersAddresses, GAA_FLAG_SKIP_ANYCAST, GAA_FLAG_SKIP_DNS_SERVER,
|
||||||
GetAdaptersAddresses,
|
GAA_FLAG_SKIP_MULTICAST, GAA_FLAG_SKIP_UNICAST, IP_ADAPTER_ADDRESSES_LH,
|
||||||
GAA_FLAG_SKIP_ANYCAST,
|
|
||||||
GAA_FLAG_SKIP_DNS_SERVER,
|
|
||||||
GAA_FLAG_SKIP_MULTICAST,
|
|
||||||
GAA_FLAG_SKIP_UNICAST,
|
|
||||||
IP_ADAPTER_ADDRESSES_LH,
|
|
||||||
},
|
},
|
||||||
Networking::WinSock::{
|
Networking::WinSock::{
|
||||||
htonl,
|
htonl, setsockopt, WSAGetLastError, WSAIoctl, AF_UNSPEC, IPPROTO_IP, IPPROTO_IPV6, IPPROTO_TCP,
|
||||||
setsockopt,
|
IPV6_MTU_DISCOVER, IPV6_UNICAST_IF, IP_MTU_DISCOVER, IP_PMTUDISC_DO, IP_UNICAST_IF, SIO_UDP_CONNRESET,
|
||||||
WSAGetLastError,
|
SOCKET, SOCKET_ERROR, TCP_FASTOPEN,
|
||||||
WSAIoctl,
|
|
||||||
AF_UNSPEC,
|
|
||||||
IPPROTO_IP,
|
|
||||||
IPPROTO_IPV6,
|
|
||||||
IPPROTO_TCP,
|
|
||||||
IPV6_MTU_DISCOVER,
|
|
||||||
IPV6_UNICAST_IF,
|
|
||||||
IP_MTU_DISCOVER,
|
|
||||||
IP_PMTUDISC_DO,
|
|
||||||
IP_UNICAST_IF,
|
|
||||||
SIO_UDP_CONNRESET,
|
|
||||||
SOCKET,
|
|
||||||
SOCKET_ERROR,
|
|
||||||
TCP_FASTOPEN,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -66,9 +46,7 @@ const FALSE: BOOL = 0;
|
|||||||
use crate::net::{
|
use crate::net::{
|
||||||
is_dual_stack_addr,
|
is_dual_stack_addr,
|
||||||
sys::{set_common_sockopt_for_connect, socket_bind_dual_stack},
|
sys::{set_common_sockopt_for_connect, socket_bind_dual_stack},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
/// A `TcpStream` that supports TFO (TCP Fast Open)
|
||||||
|
|||||||
@@ -24,14 +24,10 @@ use crate::{context::Context, relay::socks5::Address, ServerAddr};
|
|||||||
use super::{
|
use super::{
|
||||||
is_dual_stack_addr,
|
is_dual_stack_addr,
|
||||||
sys::{
|
sys::{
|
||||||
create_inbound_tcp_socket,
|
create_inbound_tcp_socket, set_common_sockopt_after_accept, set_tcp_fastopen, socket_bind_dual_stack,
|
||||||
set_common_sockopt_after_accept,
|
|
||||||
set_tcp_fastopen,
|
|
||||||
socket_bind_dual_stack,
|
|
||||||
TcpStream as SysTcpStream,
|
TcpStream as SysTcpStream,
|
||||||
},
|
},
|
||||||
AcceptOpts,
|
AcceptOpts, ConnectOpts,
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// TcpStream for outbound connections
|
/// TcpStream for outbound connections
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ use crate::{context::Context, relay::socks5::Address, ServerAddr};
|
|||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
sys::{bind_outbound_udp_socket, create_inbound_udp_socket, create_outbound_udp_socket},
|
sys::{bind_outbound_udp_socket, create_inbound_udp_socket, create_outbound_udp_socket},
|
||||||
AcceptOpts,
|
AcceptOpts, AddrFamily, ConnectOpts,
|
||||||
AddrFamily,
|
|
||||||
ConnectOpts,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Message struct for `batch_send`
|
/// Message struct for `batch_send`
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ use bytes::{Buf, BufMut, BytesMut};
|
|||||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
|
||||||
|
|
||||||
pub use self::consts::{
|
pub use self::consts::{
|
||||||
SOCKS5_AUTH_METHOD_GSSAPI,
|
SOCKS5_AUTH_METHOD_GSSAPI, SOCKS5_AUTH_METHOD_NONE, SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE, SOCKS5_AUTH_METHOD_PASSWORD,
|
||||||
SOCKS5_AUTH_METHOD_NONE,
|
|
||||||
SOCKS5_AUTH_METHOD_NOT_ACCEPTABLE,
|
|
||||||
SOCKS5_AUTH_METHOD_PASSWORD,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
|
|||||||
@@ -55,9 +55,7 @@ use std::{
|
|||||||
|
|
||||||
use aes::{
|
use aes::{
|
||||||
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
||||||
Aes128,
|
Aes128, Aes256, Block,
|
||||||
Aes256,
|
|
||||||
Block,
|
|
||||||
};
|
};
|
||||||
use byte_string::ByteStr;
|
use byte_string::ByteStr;
|
||||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ use std::{
|
|||||||
|
|
||||||
use aes::{
|
use aes::{
|
||||||
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
cipher::{BlockDecrypt, BlockEncrypt, KeyInit},
|
||||||
Aes128,
|
Aes128, Aes256, Block,
|
||||||
Aes256,
|
|
||||||
Block,
|
|
||||||
};
|
};
|
||||||
use byte_string::ByteStr;
|
use byte_string::ByteStr;
|
||||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||||
|
|||||||
@@ -32,9 +32,7 @@ use crate::{
|
|||||||
|
|
||||||
#[cfg(feature = "aead-cipher-2022")]
|
#[cfg(feature = "aead-cipher-2022")]
|
||||||
use super::aead_2022::{
|
use super::aead_2022::{
|
||||||
decrypt_client_payload_aead_2022,
|
decrypt_client_payload_aead_2022, decrypt_server_payload_aead_2022, encrypt_client_payload_aead_2022,
|
||||||
decrypt_server_payload_aead_2022,
|
|
||||||
encrypt_client_payload_aead_2022,
|
|
||||||
encrypt_server_payload_aead_2022,
|
encrypt_server_payload_aead_2022,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "stream-cipher")]
|
#[cfg(feature = "stream-cipher")]
|
||||||
|
|||||||
@@ -23,11 +23,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use super::crypto_io::{
|
use super::crypto_io::{
|
||||||
decrypt_client_payload,
|
decrypt_client_payload, decrypt_server_payload, encrypt_client_payload, encrypt_server_payload, ProtocolError,
|
||||||
decrypt_server_payload,
|
|
||||||
encrypt_client_payload,
|
|
||||||
encrypt_server_payload,
|
|
||||||
ProtocolError,
|
|
||||||
ProtocolResult,
|
ProtocolResult,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,7 @@ use shadowsocks::{
|
|||||||
utils::{copy_from_encrypted, copy_to_encrypted},
|
utils::{copy_from_encrypted, copy_to_encrypted},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ProxyClientStream,
|
ProxyClientStream, ProxyListener,
|
||||||
ProxyListener,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async fn handle_tcp_tunnel_server_client(
|
async fn handle_tcp_tunnel_server_client(
|
||||||
|
|||||||
@@ -21,9 +21,7 @@ use shadowsocks::{
|
|||||||
socks5::Address,
|
socks5::Address,
|
||||||
tcprelay::utils::{copy_from_encrypted, copy_to_encrypted},
|
tcprelay::utils::{copy_from_encrypted, copy_to_encrypted},
|
||||||
},
|
},
|
||||||
ProxyClientStream,
|
ProxyClientStream, ProxyListener, ServerConfig,
|
||||||
ProxyListener,
|
|
||||||
ServerConfig,
|
|
||||||
};
|
};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
|
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
|
||||||
|
|||||||
@@ -15,4 +15,4 @@ use_try_shorthand = true
|
|||||||
reorder_impl_items = true
|
reorder_impl_items = true
|
||||||
#use_small_heuristics = "Max"
|
#use_small_heuristics = "Max"
|
||||||
imports_layout = "HorizontalVertical"
|
imports_layout = "HorizontalVertical"
|
||||||
imports_granularity = "Crate"
|
#imports_granularity = "Crate"
|
||||||
|
|||||||
@@ -24,12 +24,7 @@ use shadowsocks_service::shadowsocks::relay::socks5::Address;
|
|||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
acl::AccessControl,
|
acl::AccessControl,
|
||||||
config::{
|
config::{
|
||||||
read_variable_field_value,
|
read_variable_field_value, Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType,
|
||||||
Config,
|
|
||||||
ConfigType,
|
|
||||||
LocalConfig,
|
|
||||||
LocalInstanceConfig,
|
|
||||||
ProtocolType,
|
|
||||||
ServerInstanceConfig,
|
ServerInstanceConfig,
|
||||||
},
|
},
|
||||||
local::{loadbalancing::PingBalancer, Server},
|
local::{loadbalancing::PingBalancer, Server},
|
||||||
@@ -44,8 +39,7 @@ use shadowsocks_service::{
|
|||||||
use crate::logging;
|
use crate::logging;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config as ServiceConfig, RuntimeMode},
|
config::{Config as ServiceConfig, RuntimeMode},
|
||||||
monitor,
|
monitor, vparser,
|
||||||
vparser,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "local-dns")]
|
#[cfg(feature = "local-dns")]
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ use shadowsocks_service::{
|
|||||||
use crate::logging;
|
use crate::logging;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config as ServiceConfig, RuntimeMode},
|
config::{Config as ServiceConfig, RuntimeMode},
|
||||||
monitor,
|
monitor, vparser,
|
||||||
vparser,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Defines command line options
|
/// Defines command line options
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ use shadowsocks_service::{
|
|||||||
use crate::logging;
|
use crate::logging;
|
||||||
use crate::{
|
use crate::{
|
||||||
config::{Config as ServiceConfig, RuntimeMode},
|
config::{Config as ServiceConfig, RuntimeMode},
|
||||||
monitor,
|
monitor, vparser,
|
||||||
vparser,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Defines command line options
|
/// Defines command line options
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ use tokio::{
|
|||||||
|
|
||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType},
|
config::{Config, ConfigType},
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ use tokio::{
|
|||||||
|
|
||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType},
|
config::{Config, ConfigType},
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ use tokio::{
|
|||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||||
local::socks::client::Socks4TcpClient,
|
local::socks::client::Socks4TcpClient,
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
shadowsocks::{
|
shadowsocks::{
|
||||||
config::{ServerAddr, ServerConfig},
|
config::{ServerAddr, ServerConfig},
|
||||||
crypto::CipherKind,
|
crypto::CipherKind,
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ use tokio::{
|
|||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||||
local::socks::client::socks5::Socks5TcpClient,
|
local::socks::client::socks5::Socks5TcpClient,
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
shadowsocks::{
|
shadowsocks::{
|
||||||
config::{Mode, ServerAddr, ServerConfig},
|
config::{Mode, ServerAddr, ServerConfig},
|
||||||
crypto::CipherKind,
|
crypto::CipherKind,
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ use tokio::{
|
|||||||
|
|
||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType},
|
config::{Config, ConfigType},
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fn random_local_tcp_port() -> u16 {
|
fn random_local_tcp_port() -> u16 {
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ use tokio::time::{self, Duration};
|
|||||||
use shadowsocks_service::{
|
use shadowsocks_service::{
|
||||||
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
config::{Config, ConfigType, LocalConfig, LocalInstanceConfig, ProtocolType, ServerInstanceConfig},
|
||||||
local::socks::client::socks5::Socks5UdpClient,
|
local::socks::client::socks5::Socks5UdpClient,
|
||||||
run_local,
|
run_local, run_server,
|
||||||
run_server,
|
|
||||||
shadowsocks::{config::Mode, crypto::CipherKind, relay::socks5::Address, ServerConfig},
|
shadowsocks::{config::Mode, crypto::CipherKind, relay::socks5::Address, ServerConfig},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user