dndx / phantun

Transforms UDP stream into (fake) TCP streams that can go through Layer 3 & Layer 4 (NAPT) firewalls/NATs.
Apache License 2.0
1.71k stars 137 forks source link

Using TcpListener and UdpSocket instead of tokio_tun #85

Closed hameda169 closed 2 years ago

hameda169 commented 2 years ago

Hello. I wanted this package to run on macOS and I figured out that the tokio_tun library doesn't support other OSs except for linux. So I wanted to know if is it possible to replace it with some raw listeners. and if the answer is yes, what are the disadvantages of this approach?

dndx commented 2 years ago

We can not use system TCP stack, as a custom TCP stack is required in order to achieve the desired effect.

See README.md:

However, the advantage of this approach is that none of the common UDP over TCP performance killer such as retransmissions and flow control will occur. The underlying UDP properties such as out-of-order delivery are fully preserved even if the connection ends up looking like a TCP connection from the perspective of firewalls/NAT devices.