简体   繁体   English

Ruby TCPSocket通过代理

[英]Ruby TCPSocket through Proxy

I have a Socket client ( Socket.tcp ) that I'd like to proxy through another machine. 我有一个Socket客户端( Socket.tcp ),我想通过另一台计算机代理。 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? 我一直浏览SOCKS库( https://github.com/samuelkadolph/ruby-proxifier ),但似乎需要在运行代码的机器上拥有一个活动代理,这将在该机器上代理所有网络流量?

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). 理想情况下,这将是Sidekiq后台作业,其中仅代理工人的代码,而不是服务器上的其他代码(它将在Rails应用程序内)被代理。

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?). 我看到Net :: SSH库( https://net-ssh.github.io/ssh/v2/api/classes/Net/SSH/Proxy/SOCKS5.html )关于SOCKS有一些东西,但我不确定如果这是最好的方法(此lib是否建立SOCKS代理?)。

Any pointers to proxying an individual socket client would be really helpful. 任何代理单个套接字客户端的指针都将非常有用。 Thanks! 谢谢!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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