1

I have connected to a socks5 server in my java application, and now I want to launch an external application and have all of its connections run through the socks5 server. The external application itself doesn't support socks5.

Any input would be great, scratching my head here..

4

2 回答 2

0

我知道如何做到这一点的 2 个技巧是替换标准运行时库或类似的技巧来拦截 OS 网络调用或在内核中设置一组微调的防火墙规则。

这两种技术都非常特定于操作系统,无法使用 java 来实现。

您最好的选择是运行现有的 socks5 包装器,并让该程序启动外部应用程序,如socksify

我对这种方法的体验参差不齐,有些应用程序可以工作,有些则不能,而且从未发现其中的任何逻辑。

YMMV

另一种方法是在 Java 应用程序中播放 tcpproxy(例如使用 Apache MINA 的东西)并让应用程序连接到 localhost 上的代理端口。同样,这仅适用于某些服务。

于 2010-09-09T17:28:00.547 回答
0

如果外部应用程序是用 Java 编写的,它确实支持 SOCKS。只需使用 -DsocksProxyHost=host 和 -DsocksProxyPort=port 运行它。见[1]。

[1]: http: //download.oracle.com/javase/6/docs/technotes/guides/net/properties.html “网络属性”。

于 2010-09-09T23:51:14.093 回答