Skip to content
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

Discussion: server-side tun2socks #195

Open
fortuna opened this issue Apr 4, 2022 · 3 comments
Open

Discussion: server-side tun2socks #195

fortuna opened this issue Apr 4, 2022 · 3 comments

Comments

@fortuna
Copy link
Contributor

fortuna commented Apr 4, 2022

One big pain of implementing Shadowsocks clients is mapping IP packets to TCP streams and UDP associations. Furthermore, it restricts the protocol support, you can't do ICMP, for instance.

A different design would have the client establish an encrypted connection (shadowsocks minus "socks") to the proxy server, and send IP packets over it, with the server working as a simple NAT. One nice thing about this is that client connections to the destination can survive network changes.

Has this been explored? If yes, what were the conclusions? If not, why not?
For instance, the stream mapping is not an issue when you are running a local SOCKS proxy client like ss-client on desktop, and sending IP packets conflicts with the local proxy approach. But it would still be very helpful in the common case of running a full system VPN as in the mobile apps.

I know there are issues with TCP over TCP, but you can mitigate that. For instance, you can increase the retransmission timeout on the tun device, or prefer TCP over UDP.

@Mygod
Copy link
Contributor

Mygod commented Apr 4, 2022

Has this been explored?

That's called a VPN. https://github.com/clowwindy/ShadowVPN

https://www.wireguard.com/

@riobard
Copy link
Contributor

riobard commented Apr 4, 2022

@fortuna Packet-oriented VPN isn't as flexible as stream-oriented Shadowsocks (and similar tools), and is difficult to create performant implementations in userspace.

@database64128
Copy link
Contributor

database64128 commented Apr 8, 2022

Instead of looking for ways to retrofit L3 packets into a L4 tunnel protocol like Shadowsocks, we can simply use a VPN to encapsulate IP packets and forward them using a simple proxy. An hour ago I finished database64128/swgp-go, a simple proxy with minimal overhead for WireGuard traffic. There are two operating modes:

  • AES block encrypt the first 16 bytes of all packets. Pad handshake packets to remove packet length characteristics. No impact on tunnel MTU. (Zero-overhead mode)
  • Optionally, pad all packets and XChaCha20-Poly1305 encrypt the whole padded packet. 42-byte overhead. (Paranoid mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants