-
Notifications
You must be signed in to change notification settings - Fork 445
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
How can I bind for IP_ADDR_ANY with port 0 to intercept all connections? #331
Comments
Indeed; if you try this on a BSD-derived network stack (on Windows, Linux, macOS...) you'll notice that the OS allocates a random ephemeral port for you in that case, rather than intercepting all connections. Smoltcp cannot allocate ephemeral ports for you because of the way it's structured, so it returns an error.
I don't understand why you need to use TCP sockets to implement a TUN-based VPN. Could you describe your requirements in more detail? |
Thanks for your reply, sincerely. I want to implement a rust version of tun2socks on windows, which can forward all traffic through a socks/http proxy. I know there are tools like Proxifier for this purpose, but it cannot handle traffic from UWP or WSL2. I want to solve this from the BTW: Thanks. |
I think it would be a very niche feature that does not justify the added maintenance burden, and I would prefer to not have it upstream. However, smoltcp is quite modular, so you should be able to reuse much of its infrastructure to achieve your goal. You could take a look at |
Thank for your advice. |
Hello, I want to implement a Tun-based VPN with smoltcp, so I need to intercept all connections.
But I didn't find a way to do that......
I have noticed that
TcpSocket::listen
simply returns aError::Unaddressable
when foundport==0
.Or is there any way to inspect the protocol in the traffic to establish the corresponding socket?
The text was updated successfully, but these errors were encountered: