I want Tor to just resolve a DNS and return the IP address before any connection to the destination server. I know that the Tor client sends a request to the exit node and the exit node does the DNS resolution and establishes a connection to that hostname. After establishing the connection to the server, the exit node returns the IP address to the client but this is not what I want. I want to resolve the DNS and get the IP without any connection to the sever. Is there any function in the source code to help me or which functions do I need to touch for this purpose.

1 Answer 1


If you're using Tor within GNU/Linux, you can use tor-resolve:

> tor-resolve tor.stackexchange.com

The program sends a DNS request and shows you the answer. The option -x also does a reverse lookup.

  • Thanks, But I need a function in the source code to give the IP address before attaching the stream to the circuit.
    – MOH
    Commented Jan 22, 2014 at 18:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .