adamfisk / LittleProxy

High performance HTTP proxy originally written by your friends at Lantern and now maintained by a stellar group of volunteer open source programmers.
https://www.getlantern.org
Apache License 2.0
2.06k stars 778 forks source link

Socks proxy server as chainproxy server? #285

Open PatrickHuetter opened 8 years ago

PatrickHuetter commented 8 years ago

Is it possible to use a socks proxy server as chain proxy server within littleproxy?

Some tools or browsers only support http proxies. I've some socks proxies and i want to use them as proxy in my browsers. I thought about tunneling the traffic with a littleproxy http proxy to the socks proxies. Is this possible?

ganskef commented 8 years ago

Hello Pattrick,

You've seen this HTTP(S)/SOCS4/SOCS5 client introduced with Netty 4.1 https://github.com/netty/netty/commit/2309a75d15ffbd063b9a710df4fa1ec3c63702f9 ?

I had a look at the tests before implementing a simple Netty 4.1 proxy. I'm afraid chaining via a SOCKS proxy isn't possible at the moment with the client implemented in LittleProxy.

After using Netty 4.1 this could be replaced, I think.

Regards Frank

Am 24.03.2016 um 12:17 schrieb Patrick Hütter:

Is it possible to use a socks proxy server as chain proxy server within littleproxy?

Some tools or browsers only support http proxies. I've some socks proxies and i want to use them as proxy in my browsers. I thought about tunneling the traffic with a littleproxy http proxy to the socks proxies. Is this possible?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/adamfisk/LittleProxy/issues/285

ganskef commented 8 years ago

Note, I've tried a proxy test client with the netty-handler-proxy and found, it supports SOCKS and tunneling via CONNECT only. Sadly this is not supported with LittleProxy, since a CONNECT causes always TLS. A bug?

A simple proxy client like it's done via URLConnection with Proxy is not supported, yet. It should be relatively easy to add, I think. It is possible with a plain netty-handler based client like LittleProxy does, but this feels like a hack, if a proxy-handler exits.

schlangguru commented 8 years ago

Does that mean, that we only can establish a proxy-to-server connection over an socks proxy if we update netty to 4.1? I just tried du add a Socks5PorxyHandler to the ProxyToServerConnection pipeline and it seems to work. But unfortunatly the littleproxy code shows a lot of warnings since it uses deprecated methods of netty 4.1.

ganskef commented 8 years ago

@Schlangguru sorry, I'm late, but here my experiences: Netty 4.1 is a backport of the Netty 5 API which deprecates the Netty 4 API. It aims to be backward compatible and I'm using it in my LittleProxy based application with no problems. You should be able too.

n8fr8 commented 7 years ago

Any progress or news on this? I am considering removing use of Polipo in favor of LittleProxy but definitely need SOCKS support on Android.

ganskef commented 7 years ago

Hi Nathan @n8fr8,

since Polipo is a caching web proxy, consider to have a look at https://github.com/ganskef/MoCuishle. It is a WWWOFFLE descendant like Polipo on top of LittleProxy. I'm using it for years on Android, Linux and Mac OS X, Windows a little. It's a one proxy <-> one client scenario. I agree Nonblocking IO provided by Netty is great in an application server, but here it could be over-sized. NIO is implemented native and therefore highly platform depended. Linux is very stable, but I've seen a lot of problems on different platforms, in case of Android on different devices :-) . Copying byte arrays with good old Java IO could be the better choice. Considering to port the application to iOS with tools like RoboVM or Intel Multi-OS Engine, I think it's another reason. Such tools are always based on the Android (Harmony based) class library, which is a little difficult with NIO and security too. For the mobile requirement I think it could be good to evaluate an okhttp based solution. It's modern HTTP with classic Java IO, roots on Android as I know, supporting SOCKS. You can find a simple proxy here https://github.com/ganskef/shortcircuit-proxy/tree/master/src/test/java/de/ganskef/okproxy

What do you think?

Regards Frank

chengdedeng commented 6 years ago

it's need to override initialized logic of ConnectionFlowStep in ProxyToServerConnection,pipeLine addfirst Socks5ProxyHandler at line 624.

anton9088 commented 6 years ago

it's need to override initialized logic of ConnectionFlowStep in ProxyToServerConnection,pipeLine addfirst Socks5ProxyHandler at line 624.

Thank you! It's working

jbaldassari commented 6 years ago

@chengdedeng @anton9088 I just submitted a PR to add support for upstream SOCKS proxies: https://github.com/adamfisk/LittleProxy/pull/417