I have been thinking lately how to check correctly whether Tor is actually working or not in an application that sends HTTP requests over Tor. I'm aware that this question is somewhat fuzzy because one needs to define "Tor is working" (and when "It is not working") and in networking world this is not an easy question.

Anyway, I've come up with the following list of thoughts what one can do:

  1. Check that Tor OS process is running [Quick heuristic]
  2. Remember the last time an HTTP request went through Tor successfully [May help when an app sends HTTP requests somewhat periodically]
  3. Check whether Tor is working using Tor control (source)
    • Send GETINFO status/circuit-established request to find out whether a circuit was established or not.
      • I'm not sure about semantics here. Is it "Is a circuit established now?" or "Was ever a circuit established?"
    • Send GETINFO traffic/read and GETINFO traffic/written requests to find out whether some data got through.
      • note: Maybe a user can write some data but nothing comes back or there is no traffic at all.
  4. Send HTTP request with URL check.torproject.org to verify Tor is really running
    • May have false negatives because:
      • Not all exits exit from their advertised IP addresses, the Tor Project probes each exit periodically but some of them change the IP they exit from semi-frequently. This means that the check.tpo site will think it's not a Tor IP address in a small number of cases and report that you aren't using Tor when infact you are. (source)
    • This sounds like a bad idea to me because it strains Tor network unnecessarily.

Note: Is there a way to ask Tor if whether it runs on a OS with correctly set system clock? This is a known issue and it sounds like a common source of troubles.

Does this approach sounds about right? Would you add something?


Edit: The question was reposted here: https://gitlab.torproject.org/tpo/core/tor/-/issues/40397

Your Answer

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

Browse other questions tagged or ask your own question.