Re: [JSch-users] Socks/Port Forwarding (local and remote) and httpproxy
Status: Alpha
Brought to you by:
ymnk
From: Paul M. R. <pm...@pa...> - 2009-12-01 11:04:14
|
On 12/01/2009 05:23 AM, Paul Michael Reilly wrote: > I've had considerable success in writing my JSch based application to > set up local and remote port forwards through an http proxy. I've also > added the keep-alive feature so that this application handles the normal > occurrence of network ups and downs in stride and keeps on ticking (or > connecting, less poetically). > > Now I would like to add a socks5 connection to the mix and I have to > confess that I'm more than a little overwhelmed on how to approach > adding a socks5 capability. The basic dilemma is that I need to set an > http proxy on the session but since socks5 is also added to a session as > a Proxy, I'm scratching my head on how to get both proxies working > simultaneously. Am I making this overly complex and there is really an > easy way to do it? > > As near as I can tell by reading the code, JSch handles multiple port > forwards assigning them each to a separate thread. But no such mechanism > exists for proxies and this does seem to make sense. What would have > struck me more sensible would have been for JSch to treat a socks > connection differently from an http proxy for example. Admittedly, I'm > out on the ledge here and ill understand these gory details. > > btw, I have the socks4/http proxy configuration working via the command > line (Ubuntu, fwiw) but now I would like to reap the benefit of > disconnect/recovery that JSch affords. Opinions? Suggestions? I've been studying the command line implementation of this feature to try to map it into JSch terminology. The command line uses "dynamic" port forwarding, i.e. the "-D port" switch on the ssh command. Now I'm thinking that this is not something that JSch supports or supports in such a way that it is not at all obvious that the two are connected. So to be real clear, here is what I have now: $ ssh -D 1234 host where host is configured to use an http proxy inside the .ssh/config file. Next I configure, say firefox, to use 1234 as a socks5 port and all works well. The Holy Grail is to accomplish this via JSch. -pmr |