There is a lot of talk about the poor old ESP32 chip not being able to handle TOR due to its resource constraints, and I know there is one library out there that might work if I had platform.io and vscode... but I have neither - I'm an Arduino IDE guy - and the briand-toresp32 is too big for me to work on.

All of that said, there is also a lot of code out there to turn an ESP32 INTO a socks proxy... but very little I can find (actually zero - hence this post) about how to connect the ESP32 TO a SOCKS proxy, which would seem like the perfect option (for an ESP32/8266 anyway).

If you use the WIFIClient.connect() method to connect to a SOCKS proxy then send the full URL into the GET/POST string, that seems to make the proxy think you want it to be an HTTP proxy... my SOCKS proxy doesn't like that.

Using a SOCKS proxy in PHP (using CURL) is easy, just needing to add 2 curl_setopt() lines:

    $ch = curl_init ( "http://myserver.onion");
    curl_setopt ( $ch, CURLOPT_PROXY, "" );

Doing it in Python (using the requests package) is even easier (and that's saying something coming from me) just setting up a proxies object:

    proxies = { "http": "socks5h://" }
    response = requests.post("http://myserver.onion", data=payload, headers=headers, proxies=proxies)

Does anyone know of a class that will handle the SOCKS stuff for me, or a really simple explanation of what I need to do to write my own or one that is almost there, that I can try and port into the Arduino IDE?

1 Answer 1


Well, unless you're using Arduino Yun or it's descendants - it will not work on board: there's too much for an AVR8 or AVR32 chip to do it. If you do need it to be used on such a chip - use an intermediate routing SBC like Raspberry Pi or it's "digital consorts": even if you'll manage to support SOCKS5h, you'll have no proper firewall to avoid data leaks

  • I have a socks proxy, the ESP32 just needs to connect to it. (EPS32 is not an AVR chip) Commented Oct 7, 2021 at 6:00
  • If you have an external SOCKS5h proxy - then it's fine
    – Alexey Vesnin
    Commented Oct 8, 2021 at 15:27

You must log in to answer this question.

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