I am currently developing a java application that is using a tor proxy running on localhost to fetch a script that is displaying the requesters ip.
I would like the work to be done mostly by the tor proxy, so that it works in its most "natural" state. My current Code looks similar to this:
SocketAddress TorProxyAddress = new InetSocketAddress("127.0.0.1", 9050);
Proxy TorProxy = new Proxy(Proxy.Type.SOCKS, TorProxyAddress);
URL url = new URL("https://myhost.com/ip2.php");
URLConnection conn = url.openConnection(TorProxy);
// ... reading the input stream etc
The problem I am now encountering is the following warn message from the tor proxy console:
[warn] Your application (using socks5 to port 443) is giving Tor only an IP address. Applications that do DNS resolves themselves may leak information. Consider using Socks4A (e.g. via privoxy or socat) instead. For more information, please see https://wiki.torproject.org/TheOnionRouter/TorFAQ#SOCKSAndDNS.'
For me, it looks like Java is resolving the ip adress of myhost.com without me wanting it to do so. As already mentioned, I need to run the tor proxy in a possibly perfect environment.
Is there any way to prevent java from pre-resolving the host and just passing the whole URL to the tor proxy?
Thank you very much for every answer!