Skip to content

Commit

Permalink
adap to ss-rust latest api
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Sep 23, 2024
1 parent f80d412 commit 9173f98
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 75 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clash_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tracing-oslog = { branch = "main", git = "https://github.com/Absolucy/tracing-oslog.git" }
tracing-appender = "0.2"

shadowsocks = { git = "https://github.com/Watfaq/shadowsocks-rust", rev = "c6cb7fd906fe9f4126f724ae252f8a67cc1926b1", optional = true, features=["aead-cipher-2022","stream-cipher"] }
shadowsocks = { version="1.21", optional = true, features=["aead-cipher-2022","stream-cipher"] }
maxminddb = "0.24"
public-suffix = "0.1"
murmur3 = "0.5"
Expand Down
167 changes: 100 additions & 67 deletions clash_lib/src/proxy/shadowsocks/datagram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@ use std::{
task::{Context, Poll},
};

use futures::{ready, Sink, SinkExt, Stream, StreamExt};
use shadowsocks::ProxySocket;
use bytes::BytesMut;
use futures::{
ready,
stream::{SplitSink, SplitStream},
Sink, SinkExt, Stream, StreamExt,
};
use shadowsocks::{
relay::udprelay::{DatagramReceive, DatagramSend},
ProxySocket,
};
use tokio::io::ReadBuf;
use tracing::{debug, instrument, trace};

Expand All @@ -17,35 +25,36 @@ use crate::{
};

/// the outbound datagram for that shadowsocks returns to us
pub struct OutboundDatagramShadowsocks {
inner: ProxySocket,
pub struct OutboundDatagramShadowsocks<S> {
inner: ProxySocket<S>,
remote_addr: SocksAddr,
flushed: bool,
pkt: Option<UdpPacket>,
buf: Vec<u8>,
resolver: ThreadSafeDNSResolver,
}

impl OutboundDatagramShadowsocks {
#[allow(clippy::new_ret_no_self)]
impl<S> OutboundDatagramShadowsocks<S> {
pub fn new(
inner: ProxySocket,
inner: ProxySocket<S>,
remote_addr: (String, u16),
resolver: ThreadSafeDNSResolver,
) -> AnyOutboundDatagram {
let s = Self {
) -> Self {
Self {
inner,
flushed: true,
pkt: None,
remote_addr: remote_addr.try_into().expect("must into socks addr"),
buf: vec![0u8; 65535],
resolver,
};
Box::new(s) as _
}
}
}

impl Sink<UdpPacket> for OutboundDatagramShadowsocks {
impl<S> Sink<UdpPacket> for OutboundDatagramShadowsocks<S>
where
S: DatagramSend + Unpin,
{
type Error = io::Error;

fn poll_ready(
Expand Down Expand Up @@ -156,19 +165,22 @@ impl Sink<UdpPacket> for OutboundDatagramShadowsocks {
}
}

impl Stream for OutboundDatagramShadowsocks {
impl<S> Stream for OutboundDatagramShadowsocks<S>
where
S: DatagramReceive + Unpin,
{
type Item = UdpPacket;

#[instrument(skip(self, cx))]
fn poll_next(
mut self: Pin<&mut Self>,
self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
let Self {
ref mut buf,
ref inner,
..
} = *self;
} = self.get_mut();

let mut buf = ReadBuf::new(buf);

Expand All @@ -188,75 +200,96 @@ impl Stream for OutboundDatagramShadowsocks {

/// Shadowsocks UDP I/O that is passed to shadowsocks relay
pub(crate) struct ShadowsocksUdpIo {
inner: AnyOutboundDatagram,
w: tokio::sync::Mutex<SplitSink<AnyOutboundDatagram, UdpPacket>>,
r: tokio::sync::Mutex<(SplitStream<AnyOutboundDatagram>, BytesMut)>,
}

impl ShadowsocksUdpIo {
pub fn new(inner: AnyOutboundDatagram) -> Self {
Self { inner }
let (w, r) = inner.split();
Self {
w: tokio::sync::Mutex::new(w),
r: tokio::sync::Mutex::new((r, BytesMut::new())),
}
}
}

impl Sink<shadowsocks::relay::udprelay::proxy_socket::UdpPacket>
for ShadowsocksUdpIo
{
type Error = io::Error;

fn poll_ready(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
self.inner.poll_ready_unpin(cx)
impl DatagramSend for ShadowsocksUdpIo {
fn poll_send(&self, _: &mut Context<'_>, _: &[u8]) -> Poll<io::Result<usize>> {
Poll::Ready(Err(new_io_error("not supported for shadowsocks udp io")))
}

fn start_send(
mut self: Pin<&mut Self>,
item: shadowsocks::relay::udprelay::proxy_socket::UdpPacket,
) -> Result<(), Self::Error> {
self.inner.start_send_unpin(UdpPacket {
data: item.data.to_vec(),
src_addr: item.src.map(|x| x.into()).unwrap_or_default(),
dst_addr: item.dst.map(|x| x.into()).unwrap_or_default(),
})
}

fn poll_flush(
mut self: Pin<&mut Self>,
fn poll_send_to(
&self,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
self.inner.poll_flush_unpin(cx)
buf: &[u8],
target: std::net::SocketAddr,
) -> Poll<io::Result<usize>> {
let mut w = self.w.try_lock().expect("must acquire");
match w.start_send_unpin(UdpPacket {
data: buf.to_vec(),
src_addr: SocksAddr::any_ipv4(),
dst_addr: target.into(),
}) {
Ok(_) => {}
Err(e) => return Poll::Ready(Err(new_io_error(e.to_string()))),
}
match w.poll_flush_unpin(cx) {
Poll::Ready(Ok(())) => Poll::Ready(Ok(buf.len())),
Poll::Ready(Err(e)) => {
return Poll::Ready(Err(new_io_error(e.to_string())))

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabihf

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-musleabihf

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-musl

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-musl

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu

unneeded `return` statement

Check failure on line 240 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu

unneeded `return` statement
}
Poll::Pending => return Poll::Pending,

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabihf

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-musleabihf

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-musl

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-musl

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu

unneeded `return` statement

Check failure on line 242 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu

unneeded `return` statement
}
}

fn poll_close(
mut self: Pin<&mut Self>,
cx: &mut Context<'_>,
) -> Poll<Result<(), Self::Error>> {
self.inner.poll_close_unpin(cx)
fn poll_send_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
let mut w = self.w.try_lock().expect("must acquire");
w.poll_ready_unpin(cx)
.map_err(|e| new_io_error(e.to_string()))
}
}

impl Stream for ShadowsocksUdpIo {
type Item = shadowsocks::relay::udprelay::proxy_socket::UdpPacket;

fn poll_next(
mut self: Pin<&mut Self>,
impl DatagramReceive for ShadowsocksUdpIo {
fn poll_recv(
&self,
cx: &mut Context<'_>,
) -> Poll<Option<Self::Item>> {
match ready!(self.inner.poll_next_unpin(cx)) {
Some(pkt) => {
let (src, dst) = (
pkt.src_addr.must_into_socket_addr(),
pkt.dst_addr.must_into_socket_addr(),
);
Poll::Ready(Some(
shadowsocks::relay::udprelay::proxy_socket::UdpPacket {
data: pkt.data.into(),
src: src.into(),
dst: dst.into(),
},
))
buf: &mut ReadBuf<'_>,
) -> Poll<io::Result<()>> {
let mut g = self.r.try_lock().expect("must acquire");
let (r, remained) = &mut *g;

if !remained.is_empty() {
let to_consume = buf.remaining().min(remained.len());
let consume = remained.split_to(to_consume);
buf.put_slice(&consume);
Poll::Ready(Ok(()))
} else {
match r.poll_next_unpin(cx) {
Poll::Ready(Some(pkt)) => {
let to_comsume = buf.remaining().min(pkt.data.len());
let consume = pkt.data[..to_comsume].to_vec();
buf.put_slice(&consume);
if to_comsume < pkt.data.len() {
remained.extend_from_slice(&pkt.data[to_comsume..]);
}
Poll::Ready(Ok(()))
}
Poll::Pending => return Poll::Pending,

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabihf

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-musleabihf

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-musl

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-musl

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu

unneeded `return` statement

Check failure on line 278 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu

unneeded `return` statement
Poll::Ready(None) => return Poll::Ready(Ok(())),

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabihf

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-musleabihf

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-musl

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-musl

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu-static-crt

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu

unneeded `return` statement

Check failure on line 279 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu

unneeded `return` statement
}
None => Poll::Ready(None),
}
}

fn poll_recv_from(
&self,
_: &mut Context<'_>,
_: &mut ReadBuf<'_>,
) -> Poll<io::Result<std::net::SocketAddr>> {
Poll::Ready(Err(new_io_error("not supported for shadowsocks udp io")))
}

fn poll_recv_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabihf

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-gnueabi-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / armv7-unknown-linux-musleabihf

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-musl

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-pc-windows-msvc-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-apple-darwin

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-apple-darwin-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-musl

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / x86_64-unknown-linux-gnu-static-crt

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / i686-unknown-linux-gnu

unused variable: `cx`

Check failure on line 292 in clash_lib/src/proxy/shadowsocks/datagram.rs

View workflow job for this annotation

GitHub Actions / aarch64-unknown-linux-gnu

unused variable: `cx`
Poll::Ready(Ok(()))
}
}
7 changes: 2 additions & 5 deletions clash_lib/src/proxy/shadowsocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,11 @@ impl OutboundHandler for Handler {
)
.await?;

let socket = ProxySocket::from_io(
let socket = ProxySocket::from_socket(
UdpSocketType::Client,
ctx,
&cfg,
Box::new(ShadowsocksUdpIo::new(socket)),
None,
#[cfg(unix)]
None,
ShadowsocksUdpIo::new(socket),
);
let d = OutboundDatagramShadowsocks::new(
socket,
Expand Down

0 comments on commit 9173f98

Please sign in to comment.