Detect if the network goes down
Implement a way for tor to detect if the network went down. This has multiple use cases (see list of tickets), one for instance is being able to differenciate between "We couldn't connect to a Guard because the Guard is down" vs "We couldn't connect because the network is down". For a more thorough discussion about Guard and network connectivity: https://lists.torproject.org/pipermail/tor-dev/2014-August/007346.html
Furthermore, this also makes a difference when we want to either keep a circuit or kill it depending on if the network went down or not.
We can get this kind of information from the OS, we need an API generic enough that allows us to build a compat layer for each OS. Let's also make sure it's integrated with the latest control command GETINFO network-liveness
and the event NETWORK_LIVENESS
.
Tickets that could benefit from this: legacy/trac#8239 (moved), legacy/trac#12595 (moved)