I want to have a program I'm writing interact with the Internet exclusively through Tor. After perusing the Tor project's documentation it appears that they do not specify the API anywhere i.e. how a program can talk to Vidalia to access the Internet through Tor. This is much talk about proxies but I don't care about that approach. I don't want to have the option of using the Internet without Tor. I only want to use Tor. Where is the API? Thanks.
-
The answer about Proxies is correct. Vidalia is jut one interface for viewing the status of Tor, starting and stopping it, etc. arm is another such interface. To connect to the internet through Tor you use the SOCKS4a or SOCKS5 proxy which it provides. You don't have to provide the user with an option to turn that off. Vidalia isn't related to what you want to do.– user5Commented Oct 14, 2013 at 16:51
3 Answers
To have your program use the Internet through Tor, just teach it to use Tor as a SOCKS4a or a SOCKS5 proxy.
The Wikipedia page on SOCKS should have the information you need.
While nickm's answer of "Use SOCKS, that's what it's there for" is correct, I think you might be asking the wrong question. If you want to get information about other aspects of Tor, but don't want to perform queries, implement SOCKS, etc. yourself, you can always use one of the existing libraries. In Python, for instance, you can use Stem.
If you're wanting to control Tor yourself, you can read up on the control protocol.
I've marked this answer CW; if anyone knows other API's designed for interacting with Tor please list them below:
-
-
Ah, gotcha, in that case you might want to clarify your original question to make it easier for other people to find it (when searching via a search engine for instance).– user5Commented Oct 29, 2013 at 17:34
-
We maintain jtorctl now in a separate git repo: github.com/guardianproject/jtorctl Commented Sep 16, 2015 at 13:34
-
1@Hans-ChristophSteiner This answer is marked as community wiki, so feel free to update the link :)– user5Commented Sep 16, 2015 at 17:49
For a tutorial on client usage through tor see here. Stem is one of the most feature complete controller libraries, but there's certainly others available too.