Skip to content

API for bootstrap/status checking

There should be a tor-client level API that can be used to notice bootstrap events in progress, and to ask the client what its status is.

This might be based around tracing; if so we should do #74 (closed) as part of this.


Here's a sketch design.

The inputs to bootstrapping status are:

  • Have we opened a connection to a directory guard? (ChanMgr knows this.)
  • Have we built a one-hop circuit? (CircMgr knows this.)
  • Have we opened a connection to anybody? (ChanMgr knows this.)
  • How much directory info do we have? (DirMgr knows this, with help from GuardMgr and NetDir.)
    • A consensus? Is it fresh? Is it valid?
    • Microdescriptors? If so, what fraction of paths can we build? What fraction of primary guards are we missing?
  • Have we built multihop circuits? (CircMgr knows this.)

We can collect all of these in a BootstrapStatus object at the arti_client level, and fire an event on a stream whenever it changes. We should also give a function that gives the latest [BootstrapStatus]. It might make sense to use something like postage::watch for that—or at least, to define "when the event is fired" in a way that allows us to later make that optimization.

Internally, we should expose the lower-level events that bootstrapping is based on from their own modules, either via tor-events or via a more lightweight mechanism, as well as functions to check the status of those events. Then, we should have a task running in tor-client that watches those events and updates a BootstrapStatus object.

Edited by Nick Mathewson