Distinguish when a Tor HS is "not found" vs "not reachable" (exists / does not exists)

Tor2web software (but also on other software) need to provide a different response depending if a Tor Hidden Service that a user is trying to access exists or not.

The error handling revealed that today there's no specific return code to distinguish between:

  • TorHS does not exists
  • TorHS exists (and then it maybe reachable or not)

So in order to mimic the error-response typical of internet environment:

  • Host not found (TorHS does not exists)
  • Host unreachable (Tor HS exists but is not reachable)

After a discussion on IRC with Nick and sebastian the following conclusion arised:

nickm: so, this concept of ==== "We can have "exists" mean "This HS has been running recently, and has been attempting to provide service", though and implement that by saying that an HS "exists" if we find a descriptor for it, and doesn't exist if we don't. ==== is already "available" os must be implemented?

nickm naif: I don't think that's exposed from Tor right now.

This ticket is to provide an implementation for that feature.

Whenever possible we should use a Return Code from Socks Server following SOCKS protocol so that a Socks Client can parse the result and know that connection to this TorHS is "Not Found".

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information