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
    Jan 22, 2014 at 18:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.