简体   繁体   中英

Ruby TCPSocket through Proxy

I have a Socket client ( Socket.tcp ) that I'd like to proxy through another machine. I've blooked in to SOCKS libraries ( https://github.com/samuelkadolph/ruby-proxifier ), but it seems to require having an active proxy on the machine the code is running, which would proxy ALL network traffic on the machine?

Ideally, this will be a Sidekiq background job where just the worker's code is proxied, not the other code on the server (it will be within a Rails application).

I see the Net::SSH library ( https://net-ssh.github.io/ssh/v2/api/classes/Net/SSH/Proxy/SOCKS5.html ) has some stuff around SOCKS, but I'm unsure if this is the best approach (does this lib establish the SOCKS proxy?).

Any pointers to proxying an individual socket client would be really helpful. Thanks!

最后在应用程序服务器上使用ssh -D隧道,并在应用程序中保留对代理的引用,并修补网络库以使用https://github.com/samuelkadolph/ruby-proxifier

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM