Skip to content
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

Add UDP support #51

Closed
wants to merge 106 commits into from
Closed

Add UDP support #51

wants to merge 106 commits into from

Conversation

whyvl
Copy link
Owner

@whyvl whyvl commented Oct 7, 2022

This PR adds UDP client support for wireproxy, meaning that outward UDP traffic can now be proxied. This PR does not include support for UDP inward traffic.

Closes #30
Closes #15
Closes #37

@whyvl
Copy link
Owner Author

whyvl commented Oct 7, 2022

@JJRcop if you don't mind please test if this works so I can merge it. Thanks!

@JJRcop
Copy link

JJRcop commented Oct 7, 2022

@octeep Because inward UDP traffic isn't supported, µTP from torrents and DHT peers still doesn't work, however https://github.com/txthinking/testsocks5 passes the UDP test now, and it didn't before.
Screenshot_20221007_162324

Also "closes" or "fixes" keywords on github doesn't work with multiple issues in a row, you have to write

Closes #30
Closes #15
Closes #37 (but it doesn't fix this one)

So I'd say the UDP part might work, and nothing is broken, it works with TCP just like before, but because receiving UDP doesn't work, it still doesn't support the UDP mode (with µTP) from torrenting

@whyvl
Copy link
Owner Author

whyvl commented Oct 7, 2022

@octeep Because inward UDP traffic isn't supported, µTP from torrents and DHT peers still doesn't work, however https://github.com/txthinking/testsocks5 passes the UDP test now, and it didn't before. Screenshot_20221007_162324

Also "closes" or "fixes" keywords on github doesn't work with multiple issues in a row, you have to write

Closes #30 Closes #15 Closes #37 (but it doesn't fix this one)

So I'd say the UDP part might work, and nothing is broken, it works with TCP just like before, but because receiving UDP doesn't work, it still doesn't support the UDP mode (with µTP) from torrenting

Does µTP works with devices behind NAT? If so this should work as well.

@JJRcop
Copy link

JJRcop commented Oct 7, 2022

I'm testing with qBittorrent using these settings with an ubuntu iso from https://ubuntu.com/download/alternative-downloads#bittorrents

Screenshot_20221007_163301

Screenshot_20221007_163348

I'm only able to connect to TCP peers and only discover via PeX as described in #37.

This shows up in wireshark around the time i launch the torrent with the µTP enabled, not sure if it helps

Screenshot_20221007_164455

And this shows up in the log around that time (it's a bunch of TCP stuff, so probably unrelated)

Screenshot_20221007_164654

Does µTP works with devices behind NAT? If so this should work as well.

Supposedly it should

@JJRcop
Copy link

JJRcop commented Oct 7, 2022

Sorry for the overload of information, I am a bit out of my element here, I don't know what the real problem is or what the solution is, just that what I'm trying to use it for doesn't work. I hope I've given enough info to reproduce my issue: using qBittorrent's SOCKS5 mode with proxying peer connections enabled (very key, or the torrent download won't go through the proxy!) and µTP enabled.

@JJRcop
Copy link

JJRcop commented Oct 7, 2022

Another test I've been trying is https://networktest.twilio.com/, and its UDP doesn't work either.

@whyvl
Copy link
Owner Author

whyvl commented Oct 7, 2022

Another test I've been trying is https://networktest.twilio.com/, and its UDP doesn't work either.

What are you using to test this? I was hoping to use TURN to check if UDP works as well but I couldn't find a TURN client that supports SOCKS5.

Edit: I misunderstood what this does. Ignore this.

@JJRcop
Copy link

JJRcop commented Oct 7, 2022

What are you using to test this?

I have a Firefox profile set up to connect to my wireproxy via SOCKS5, and I visit https://networktest.twilio.com/. I plug in my webcam and have it face the wall just in case.

Wireproxy is hooked up to go to a SurfShark VPN through WireGuard

These are the results I'm getting through wireproxy:

Screenshot_20221007_174446

And these are the results when using wireguard directly:

Screenshot_20221007_175623

Edit: Missed your edit, ignore this???

@whyvl
Copy link
Owner Author

whyvl commented Oct 8, 2022

What are you using to test this?

I have a Firefox profile set up to connect to my wireproxy via SOCKS5, and I visit https://networktest.twilio.com/. I plug in my webcam and have it face the wall just in case.

Wireproxy is hooked up to go to a SurfShark VPN through WireGuard

These are the results I'm getting through wireproxy:

Screenshot_20221007_174446

And these are the results when using wireguard directly:

Screenshot_20221007_175623

Edit: Missed your edit, ignore this???

I tried this on Firefox as well and it reported UDP as working, not sure what's going on here. Then I tried using deluge but couldn't get it to work. Again, it's very hard to find an actual software good for debugging UDP ASSOCIATE support. txthinking's test utils seems to say it works so I'm really not sure what's going on here.

@JJRcop
Copy link

JJRcop commented Oct 8, 2022

I think Deluge set to uTP mode is a great way to test. It uses libtorrent, just like qBittorrent, and libtorrent uses UDP ASSOCIATE. Is there something you feel you're missing from that?

Also, the most recent Ubuntu ISOs always have a lot of seeds

@JJRcop
Copy link

JJRcop commented Oct 17, 2022

This might help. I found this python program (requires PySocks from your distro or pip) https://github.com/semigodking/socks5chk
running the udpchk.py script—which pings google's dns service—shows this in wiresocks output:

Screenshot_20221017_162117

@demono1d
Copy link

On version from this PR connection through socks is unstable, easy to observe with web app having websocket

@JJRcop
Copy link

JJRcop commented Dec 6, 2022

This page from the standard might help: https://www.rfc-editor.org/rfc/rfc1928#page-7
(also, the whole standard is good to validate against)

@JJRcop
Copy link

JJRcop commented Dec 12, 2022

I finally found a current torrent that can be used as a benchmark for UDP torrent support, at least when it comes to trackers: Linux Mint 21 Cinnamon Edition.

This torrent has many many seeds and is very reliable for testing.

You can find it here: https://linuxmint.com/edition.php?id=299
(direct link to torrent file)

Magnet link: magnet:?xt=urn:btih:14bb29461c2243aa287cda681488e57c9eeb25af&dn=linuxmint-21-cinnamon-64bit.iso&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce
(notice that the tracker is UDP)

Currently this torrent does not download at all with this version. Try it with deluge and you'll see what I mean, check the tracker status in the Trackers tab. Don't forget to set deluge up with socks5 in the proxy settings.

Screenshot_20221212_032116

@christaikobo
Copy link

I would like to chime in a bit, providing my own observation.

I was basically trying to do the same thing, just with openvpn (in a docker container) instead of wireguard. txthinking's testsocks5 is NOT a reflection of realworld outcome. I banged my head on it for some weeks.

@0xThiebaut
Copy link

you'll see what I mean, check the tracker status in the Trackers tab. Don't forget to set deluge up with socks5 in the proxy settings.

It's been a while but please note that currently enabling SOCKS5 on Deluge/qBittorrent disables the listening port as per arvidn/libtorrent#7726

@Neustradamus
Copy link

@pufferffish: Why have you closed your PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not working properly with torrenting UDP Support Change Socks5 Server Library