0

I am looking for a (preferably Open Source) API usable in C/C++, that enables one to send/receive data over the Tor network. So I want to build an application that uses sockets to communicate data over a network, but I want that data to be sent over the Tor network instead. Is that possible? Is there a API for it?

1
  • I don't think there are any well-supported C APIs. There are generally two options for accessing Tor through an API. You can communicate to a separate Tor process using the Tor control protocol and SOCKS port, or you can statically link tor into your program (for example iCepa for iOS). If you're more specific about what your requirements are, you might get more help.
    – Steve
    Commented May 3, 2021 at 23:51

1 Answer 1

1

So I want to build an application that uses sockets to communicate data over a network, but I want that data to be sent over the Tor network instead.

You could enable socks5 proxy in your /etc/tor/torrc tor's config:

SocksPort 9050

Now, simply open your socket to this port, tell socks5 proxy what you want. Ssl/no-ssl, which site/ip-address/.onion domain to get, auth/no-auth, etcetera... So, your task renamed/reshaped from "How to C/Api Tor" to "how to pass request via socks5 proxy on C/C++ language" which is much more older and easiest task in the world. And of-course there are thousands of code snippets over the network and stack-overflow, which are doing this on all languages in all possible ways.

RFC: https://www.ietf.org/rfc/rfc1928.txt

You must log in to answer this question.

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