Cloak icon indicating copy to clipboard operation
Cloak copied to clipboard

[Question] How to use shadowsocks udp with cloak 2.1.1

Open MigueSpark opened this issue 6 years ago • 11 comments

Hello, i need help with this because im using shadowsocks with cloak and when i try to use udp it doesnt work on android, here is my shadowsocks libev config:

"server":"127.0.0.1", "server_port":56781, "password":"*********", "timeout":60, "method":"chacha20-ietf-poly1305", "nameserver":"8.8.8.8", "mode":"tcp_and_udp" My cloak config is this: { "ProxyBook": { "shadowsocks":["udp","127.0.0.1:56781"] , "panel":["tcp","127.0.0.1:0"] }, "BypassUID": [ "**", "**" ], "BindAddr":[":443"], "RedirAddr": "204.79.197.200", "PrivateKey": "**", "AdminUID": "**", "DatabasePath": "userinfo.db", "StreamTimeout": 300 } Note: All * means that i replace them to post here but original values are on the vps

MigueSpark avatar Sep 26 '19 04:09 MigueSpark

I think not gonna work. Proxy book for shadowsocks must be tcp.

malikshi avatar Sep 26 '19 04:09 malikshi

Or try force run shadowsocks only in udp `-U' case sensitive

malikshi avatar Sep 26 '19 04:09 malikshi

https://github.com/shadowsocks/shadowsocks-org/issues/28 I think Shadowsocks doesn't support udp for its plugins.

b. Only TCP traffic is forwarded. For now, there is no plan to support UDP traffic forwarding.

What about let UDP bypass for now? UDP over TCP expects very poor performance.

Klaaktu avatar Sep 26 '19 08:09 Klaaktu

I am using proxy book openvpn with udp its greats, I know speed won't be good compared to shadowsocks, but I can use it for game and etc

malikshi avatar Sep 26 '19 08:09 malikshi

If you use a plugin in Shadowsocks, The UDP will not be working.

Restrictions a. Plugin over plugin is NOT supported. Only one plugin can be enabled when a shadowsocks service is started. If you really need this feature, implement a plugin-over-plugin transport as a SIP003 plugin. b. Only TCP traffic is forwarded. For now, there is no plan to support UDP traffic forwarding.

via: https://shadowsocks.org/en/spec/Plugin.html

chenshaoju avatar Sep 27 '19 03:09 chenshaoju

WireGuard seems like a nice alternative to OpenVPN in terms of gaming, is it able to pair with Cloak too?

Klaaktu avatar Nov 12 '19 10:11 Klaaktu

@klaaktu A while ago I have actually experimented pairing WireGuard with Cloak. Theoretically Cloak should work with anything that lets you tunnel UDP traffic, but I'm not familiar with WireGuard so unfortunately I couldn't find a way to configure WireGuard that works.

cbeuw avatar Nov 12 '19 10:11 cbeuw

@cbeuw i will try this one, i hope speed are good like original speed wireguard itself

malikshi avatar Nov 12 '19 11:11 malikshi

Wait... can u tunnel UDP traffic from Shadowsocks if you run Cloak in standalone mode? Is there a way to test this?

Edit: nope... same error as WireGuard when tested in Sockscap64.

Edit2: Change to "NumConn": 1 and no more ck-client error when tunneling Shadowsocks UDP. It's the same for WireGuard and OpenVPN, now they connect without problem (I can open websites). However Shadowsocks' server side gives this error:

ERROR: failed to handshake with ::1: authentication error
ERROR: failed to handshake with 127.0.0.1: authentication error

WireGuard client gives this error, if endpoint is localhost instead (with "kill-switch" disabled):

Failed to send data packet write udp4 0.0.0.0:53457->127.0.0.1:1984: wsasendto: The requested address is not valid in its context.

Klaaktu avatar Nov 15 '19 22:11 Klaaktu

cloak with standalone mode

you can use ss with cloak[tcp] or only ss[tcp&udp]

qwerttvv avatar Jan 11 '20 15:01 qwerttvv

Sry I might have forgotten to change Shadowsocks ProxyBook entry to UDP or restart ck-server after editing, the error message hinted at it since handshake is for TCP. Anyway it seems UDP does work with Shadowsocks!

Testing UDP Associate...
Proxy server bound on 127.0.0.1:1080 for udp relay.
Testing data transmission...
The UDP transmission testing was successful.

What I did: Shadowsocks client settings, change to 127.0.0.1:1984 no plugin. ck-client, add -u parameter, and change NumConn to 1 in config file (#96). ck-server config, ProxyBook shadowsocks entry, change 'tcp' to 'udp'. Restart ck-server.

For TCP+UDP I think I need: 2 ck-client, 2 config files with different ProxyMethod names. One listens to tcp the other udp (same port number). ck-server 2 ProxyBook entries as well. One "tcp" one "udp".

Klaaktu avatar Mar 27 '20 10:03 Klaaktu