-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API - Support Stream+Sink for ProxySocket? #1608
Comments
There is no Datagram based sockets in Rust's common libraries supports
So what exactly problem are you struggling on? |
there's Sink and Stream https://docs.rs/futures/latest/futures/sink/trait.Sink.html i'd like to have ss wrap another UDP transport which impls Sink and Stream |
You can make a wrapper that wraps |
essentially i want to pass something that is Sink here https://github.com/Watfaq/clash-rs/blob/master/clash_lib/src/proxy/shadowsocks/mod.rs#L234 |
So you want the underlying socket implements That would require quite a lot of changes in the current implementation.
I don't see the necessity here because the underlying connection is not a "stream" based connection. |
There's nothing todo with a stream. and I think the Sink and Stream trait is the AsyncRead and AsyncWrite for Udp or any segmented io. I know it's a fundamental change that requires amount of work. I've had a look into the current code, it doesn't look like any udpsocket API is accessed other than the io related, which are fully replaceable by the Sink and Stream traits. I'm happy to make the changes if it we agreed it's way to go |
Please make a PR. |
I'm working on this and realized a lot of the io methods take tokio ToSocketAddrs https://github.com/Watfaq/shadowsocks-rust/blob/7c154d2340849cdabb5971b3b6982f187a6b7efe/crates/shadowsocks-service/src/net/mon_socket.rs#L50 which is handing the DNS to sys resolver, should we change it to take plain SocketAddr and resolve the dns_resolver in the code base? |
|
Yeah I get it. Should we not use sys dns and use hickory dns for all? |
The tcp stream does take opaque AsyncRead and AsyncWrite as underlying io https://docs.rs/shadowsocks/latest/shadowsocks/relay/tcprelay/proxy_stream/client/struct.ProxyClientStream.html#impl-AsyncRead-for-ProxyClientStream%3CS%3E
thoughts about having the udp socket to take Stream + Sink too ?
https://docs.rs/shadowsocks/latest/shadowsocks/relay/udprelay/proxy_socket/struct.ProxySocket.html
so it can be applied to proxy more general udp transports
The text was updated successfully, but these errors were encountered: