microsocks icon indicating copy to clipboard operation
microsocks copied to clipboard

Why SOCKS5 only?

Open lars18th opened this issue 4 years ago • 11 comments

Hi,

I'm testing with CURL and it only supports SOCKS5 protocol, and not SOCKS4. So curl --socks5 works, but curl --socks4 doesn't.

Please, can you provide dual protocol support? Thank you!

lars18th avatar Apr 22 '20 10:04 lars18th

I'm testing with CURL and it only supports SOCKS5 protocol, and not SOCKS4

so microsocks and curl are perfectly compatible...

Please, can you provide dual protocol support?

why ?

rofl0r avatar Apr 29 '20 20:04 rofl0r

I'm testing with CURL and it only supports SOCKS5 protocol, and not SOCKS4

so microsocks and curl are perfectly compatible...

With --socks5 yes; but when you try with SOCKS4, then NO!

Please, can you provide dual protocol support?

why ?

Because I want to use it as an upstream proxy using the SOCKS4 protocol.

lars18th avatar Apr 30 '20 17:04 lars18th

With --socks5 yes; but when you try with SOCKS4, then NO!

as expected...

Because I want to use it as an upstream proxy using the SOCKS4 protocol.

what advantage do you expect from using SOCKS4 ?

rofl0r avatar Jul 07 '20 11:07 rofl0r

With --socks5 yes; but when you try with SOCKS4, then NO!

as expected...

That's the reason to request for supporting SOCKS4.

Because I want to use it as an upstream proxy using the SOCKS4 protocol.

what advantage do you expect from using SOCKS4 ?

Advantage? Nothing in fact. But not all socks clients support the SOCKS5 protocol. A lot supports only SOCKS4. So to use this tool another SOCKS5->SOCKS4 translator is required.

So, please consider to support both versions. Regards.

lars18th avatar Jul 07 '20 14:07 lars18th

A lot supports only SOCKS4

do you have some actual examples of programs supporting only socks4 ?

rofl0r avatar Jul 07 '20 15:07 rofl0r

do you have some actual examples of programs supporting only socks4 ?

Any Java application based on the HTTP client library from jetty (https://www.eclipse.org/jetty/) will not be able to use a socks5-only proxy since it only supports socks4 and socks4a.

https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-client/src/main/java/org/eclipse/jetty/client/Socks4Proxy.java#L109

x-qq avatar Jan 29 '23 08:01 x-qq

And not only all Java apps but all based on SSH fordwarding. In fact you can found more clients supporting only Socks4 than clients supporting Socks5 version.

lars18th avatar Jan 29 '23 18:01 lars18th

i made a socks4 server implementation in python, you can use it instead: https://github.com/rofl0r/pysocks4

rofl0r avatar Feb 01 '23 14:02 rofl0r

socat only supports socks4 FWIW

lazcamus avatar Mar 27 '23 15:03 lazcamus

socat only supports socks4 FWIW

And a lot of other tools only supports socks4. That's the reason to request to "upgrade" microsoks with v4 support. That seems to be easy as v4 is subset of v5 with only small differences.

lars18th avatar Mar 28 '23 20:03 lars18th

the difference is not that small, even the number of packets for handshake differs (here, socks4a is more efficient in that it requires less traffic, which is why tor defaults to it). i estimate that supporting socks4a in addition to socks5 would require adding about 20% more code and it would make everything more convoluted. it would make more sense to fork microsocks for this purpose and make it socks4a only. but then, pysocks4 seems good enough for me, apart from not being written in C.

And a lot of other tools only supports socks4.

you keep repeating that, but so far only socat and an exotic java library called jetty have been mentioned. you gotta provide more examples to convince me there's really "a lot" of them.

rofl0r avatar Mar 28 '23 20:03 rofl0r

I'll add into this, socks4 support can be added as a module or as a extra feature that isn't even built by default, it doesn't have to actually complicate the code in main.c itself. Plus, jetty is not at all exotic. It's a massive (and widely used) java network library.

fucksophie avatar Apr 13 '24 17:04 fucksophie

microsocks is not GNU software, it doesn't try to be everything at once - there are other socks proxy implementations for that. it's a minimal, yet fully usable and performant implementation of one thing. in my opinion it's also a good example for a multithreaded TCP server app to be used for teaching. adding all sorts of features to it would make it hard to read and modify.

rofl0r avatar Apr 13 '24 22:04 rofl0r