I'm trying to use TOR Browser in my code like this:

Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("", 9150));
//add proxy to some other Java class to use
System.out.println(proxy.address()); //

It would print the locahost address instead of the IP the TOR Browser routes the traffic to. Is there a way to get the later?

  • Are you saying the you want the IP of the guard node?
    – elmerjfudd
    Jan 17, 2020 at 22:30
  • @JSEvans I want the IP that the final site that my program connects to, sees
    – parsecer
    Jan 18, 2020 at 12:41
  • Did you solved your problem ? I face the same issue : I have a Java program which connect to https website. I want to use tor to connect https instead of my own ips. Did you succeed to get Tor Ips ? If yes can you show me how ? Thanks Ben Mar 29, 2020 at 17:26
  • This is not a straightforward thing to do. You probably want to interact with Tor's control protocol. You should watch for stream events and identify the circuit id that belongs to your new stream. Then you can ask Tor for the circuit path and then look up the IP address belonging to the last hop in the circuit.
    – Steve
    Mar 29, 2020 at 19:12


You must log in to answer this question.

Browse other questions tagged .