rofl0r / microsocks

tiny, portable SOCKS5 server with very moderate resource usage
Other
1.48k stars 266 forks source link

Why SOCKS5 only? #24

Closed lars18th closed 5 months ago

lars18th commented 4 years ago

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!

rofl0r commented 4 years ago

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 ?

lars18th commented 4 years ago

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.

rofl0r commented 4 years ago

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 ?

lars18th commented 4 years ago

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.

rofl0r commented 4 years ago

A lot supports only SOCKS4

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

x-qq commented 1 year ago

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

lars18th commented 1 year ago

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.

rofl0r commented 1 year ago

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

lazcamus commented 1 year ago

socat only supports socks4 FWIW

lars18th commented 1 year ago

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.

rofl0r commented 1 year ago

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.

fucksophie commented 5 months ago

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.

rofl0r commented 5 months ago

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.

cloudrac3r commented 5 months ago

I really appreciate that microsocks keeps it really simple and effective. It does one thing well and doesn't require any complicated setup, configuration files, user accounts, none of that. Thank you for making this software.

lars18th commented 5 months ago

Hi @cloudrac3r (and @rofl0r),

We all really appreciate that microsocks makes things simple and efficient. We don't want to change that. However, socks is a protocol, and what we ask is that this tool supports both version 5 and version 4 of that same protocol. A parallel example might be a web server with HTTP v1.1 support that doen't support v1.0.

x-qq commented 5 months ago

Since it does not look like this is going anywhere, I'll leave this here: https://github.com/niklata/muonsocks - a minimalistic socks4/socks4a/socks5 proxy, based on microsocks

rofl0r commented 5 months ago

that's really good news. i can wholeheartedly recommend that implementation, as i know the author from the early days of musl libc development and can vouch for his skills and security-concious programming style.