wangyu- / udp2raw

A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
MIT License
7.18k stars 1.16k forks source link

Does it "handle" TCP traffic automatically? #56

Closed tonsimple closed 7 years ago

tonsimple commented 7 years ago

Which is to say, if I want to use mixed TCP/UDP traffic through this while leveraging the "faketcp" feature, would it work, or do I need something (VPN, udptunnel, etc.) to first "convert" the TCP connections to UDP?

wangyu- commented 7 years ago

Udp2raw handles only UDP traffic,which means it only turns UDP traffic into FakeTCP.It wont tunnel any TCP traffic.

do I need something (VPN, udptunnel, etc.) to first "convert" the TCP connections to UDP?

This method does work. In this way,you convert TCP to UDP at first, then convert it back to TCP(a fake one though) by udp2raw.

There is also another way:

I assume you have a server which listens to both a TCP port and a UDP port at remote host, and you want to tunnel both ports to local.You can:

First,tunnel the UDP port to local by using udp2raw.

Second,tunnel the TCP port to local by using socat/sshtunnl/iptables

tonsimple commented 7 years ago

What I basically want to do, is to use "faketcp" to circumvent certain annoying dumb mobile ISP issue, however, the application I'm working on uses both TCP (control/QOS/negotiation) and udp (audiovisual stream)

The application supports use of udp-supporting socks5 servers (Dante) so the plan was to replace OpenVPN server in your openVPN config tutorial with Dante and just point the application at 127.0.0.1:(udp2raw port)

I guess I'll have to use a slightly different config or openvpn (which is a bit too heavyweight for my usecase)

tonsimple commented 7 years ago

BTW, as a future development, ability to accept both TCP and UDP, and then convert them to "faketcp" for transfer, would be quite a useful feature

wangyu- commented 7 years ago

I am not sure if Dante will work if you simply point the application at 127.0.0.1:(udp2raw port).

But i m sure it will work perfectly if you tunnel a UDP-based VPN,and access the server by using VPN 's ip.

BTW, as a future development, ability to accept both TCP and UDP, and then convert them to "faketcp" for transfer, would be quite a useful feature

It sounds good ,but i may not develop it though.Udp2raw + any udp based vpn can already do this,if openvpn is too heavyweight for you ,maybe what you really want is some lightweight VPN.The udptunnel you mentioned can also do this when used with udp2raw together.I currently dont want to integrate a VPN or udptunnel into udp2raw.

wangyu- commented 7 years ago

I assume you have a server which listens to both a TCP port and a UDP port at remote host, and you want to tunnel both ports to local.You can: First,tunnel the UDP port to local by using udp2raw. Second,tunnel the TCP port to local by using socat/sshtunnl/iptables

Assume your Dante listens at 44.55.66.77:8000(both tcp and udp)

You can tunnel 44.55.66.77:8000 udp to 127.0.0.1:1234 udp by using udp2raw, and tunnel 44.55.66.77:8000 tcp to 127.0.0.1:1234 tcp by using socat/sshtunnel.

And then use 127.0.0.1:1234(both tcp and udp) as socks5 server.

This trick is confirmed workable with shadowsocks+udp2raw+socat/sshtunnel/iptables.(shadowsocks is a tunnel which implemented socks5 proxy).

I m not 100% sure if it will work with Dante,though.

tonsimple commented 7 years ago

Thanks, your suggestion worked!