Snawoot / opera-proxy

Standalone client for proxies of Opera VPN
MIT License
685 stars 65 forks source link

Возможность расшарить Socks Proxy #26

Closed atomexpert closed 1 year ago

atomexpert commented 2 years ago

Здравствуйте! Подскажите пожалуйста, есть ли возможность открывать порты через Socks прокси, а не http?

Snawoot commented 2 years ago

Здравствуйте! Такая возможность не реализована и не планируется. Скорее всего найдутся адаптеры, которые принимают соединения как SOCKS5-прокси и перенаправляют их в HTTP-прокси. В частности, можно взять https://github.com/Snawoot/socks5-server и сделать ему опцию, которая бы использовала кастомный Dial, который бы уже шёл в HTTP-прокси. Наверняка что-то и уже готовое имеется.

atomexpert commented 2 years ago

Понял, спасибо!

przemyslaw0 commented 1 year ago

I believe the ability to listen a SOCKS5 proxy for incoming connections would be a very good idea.

Not all programs has support for HTTP/HTTPS proxies, some has only SOCKS5 support.

An example: DNSCrypt (DNSCrypt can use HTTP/HTTPS proxies only for DNS-over-HTTPS, not for DNSCrypt protocol itself).

Here I have to convert the opera-proxy HTTP/HTTPS proxy to a SOCKS5 one using a tool, because the DNS forwarder that I use has only SOCKS5 support.

SOCKS5 support in hola-proxy would be nice too.

Snawoot commented 1 year ago

@przemyslaw0 hi!

Can you please give me a link to DNSCrypt implementation you're referring to? I believe there is a good reason for that: SOCKS5 can forward UDP traffic while HTTP proxies can't, these forward only TCP connections. opera-proxy uses some upstream HTTPS proxies which can't forward UDP too. Therefore even if I'll implement incomplete SOCKS5 support for opera-proxy, it will not be enough for DNSCrypt which is operating on UDP datagrams, not TCP connections.

przemyslaw0 commented 1 year ago

I refer to the official DNSCrypt implementation: https://github.com/DNSCrypt/dnscrypt-proxy

even if I'll implement incomplete SOCKS5 support for opera-proxy, it will not be enough for DNSCrypt which is operating on UDP datagrams, not TCP connections.

DNSCrypt can use TCP instead of UDP for tunneling with SOCKS5 proxies without UDP connectivity, such as Tor or SSH: https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml#L91-L99

Snawoot commented 1 year ago

@przemyslaw0 thanks!

Snawoot commented 1 year ago

Maybe glider can be useful to convert protocol?

przemyslaw0 commented 1 year ago

I know that glider, but here I use GO simple tunnel: https://github.com/ginuerzh/gost

gost -L socks5://127.0.0.1:8888 -F http://127.0.0.1:18080

I think it wouldn't make difference over glider, but if opera-proxy could have a SOCKS5 listener so that the additional proxy conversion tool wouldn't necessary and a little memory would be saved.

alpominth commented 1 year ago

I had a better idea: serving SOCKS5 and HTTP on same port (it's already implemented in Glider): https://github.com/nadoo/glider/blob/master/proxy/mixed/mixed.go

I don't know how to code in Go, but looking at these lines you could just replace the Glider SOCKS5|HTTP proxy by the functions provided by the packages that this package uses.

What do you think @Snawoot?

Snawoot commented 1 year ago

@alpominth great idea, I like it!

Not sure if implementation will be that easy as copy-paste, though.

If someone will offer pull request with viable changeset, I'll be glad to accept it.

alpominth commented 1 year ago

@Snawoot

Well, I do not know how to code in Go, but I asked ChatGPT for creating a sample program that listen on HTTP+SOCKS5:

https://pastebin.com/tEcknUBx

Maybe, it could serve as a basis.

przemyslaw0 commented 1 year ago

By lurking at snawoot repositories, it's a good idea to implement SOCKS5 listener in hola-proxy too.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Cuteistfox commented 5 months ago

remove the stale issue bot