cordova-plugin-tun2socks icon indicating copy to clipboard operation
cordova-plugin-tun2socks copied to clipboard

fully support UDP

Open Xmader opened this issue 6 years ago • 2 comments

merge code from Outline

Xmader avatar Oct 14 '19 17:10 Xmader

Is that for UDP associate? actually it won't work.
I been testing it, the UDP associate will only work if you disable the UDP relay and the transparent DNS (See this comment by @bemasc https://github.com/ambrop72/badvpn/pull/71#issue-238833938): https://github.com/UWNetworksLab/cordova-plugin-tun2socks/blob/ab12b21ad3140efc08e7cd4d378a614e05704a79/android/java/org/uproxy/tun2socks/Tunnel.java#L205 https://github.com/UWNetworksLab/cordova-plugin-tun2socks/blob/ab12b21ad3140efc08e7cd4d378a614e05704a79/android/java/org/uproxy/tun2socks/Tunnel.java#L207 Just like that:

    startTun2Socks(
        tunFd,
        VPN_INTERFACE_MTU,
        mPrivateAddress.mRouter,
        VPN_INTERFACE_NETMASK,
        VPN_IPV6_NULL,
        socksServerAddress,
-       socksServerAddress,  // The UDP relay has the same address and port as the SOCKS server.
+       null,
        String.format("%s:%d", DNS_RESOLVER_IP, DNS_RESOLVER_PORT),
-       true /* transparent DNS */,
+       false,
        true /* socks5 UDP Enabled */);

iMrDJAi avatar Apr 01 '21 21:04 iMrDJAi

I have published a working version that supports SOCKS v5 UDP associate based on your implementation:
https://github.com/iMrDJAi/cordova-plugin-tun2socks-udp-associate

Thank you!

iMrDJAi avatar Jun 09 '21 10:06 iMrDJAi