Support loading of custom consensus and/or disable automatic consenus retrieval
We've been looking into using Arti as a Tor library for mobile apps. In our settings, the amount of daily data sent (kilobytes) is very small compared to retrieving the consensus (megabytes). To reduce mobile bandwidth load, we made some modifications to Arti to run with a smaller consensus that is updated less frequently. See LightArti.
We are currently running with some modifications to stock Arti to facilitate loading a custom consensus. We made the following changes:
- We removed the code related to fetching the consensus, certificates, and microdescriptors from the network, the static data related to Tor directory authorities, and the code to renew these documents regularly.
- Instead, we customized tor-dirmgrto obtain consensus + descriptor information from files that have been provided out-of-band (in our case, we cache these data for a few days, and just pointtor-dirmgrto the directory containing these files)
You can find a (rough) diff wrt an older version of arti here.
It would be fantastic if we could make loading of a custom consensus part of stock Arti so that we can update LightArti to use that interface directly. Here are some of our ideas that we think might work:
- To split the retrival and loading of documents in DirMgr, and to add the ability to load directory information from raw documents, like raw consensus data, or raw microdescriptors data.
- To modify DirCfgto allow the bootstrap to instantiate aDirMgrfrom pre-loaded documents, maybe in the same way it can customize authorities with theset_authoritiesmethod.
- As we not need to refresh the directory info regularly, it could be worth it to "subclass" DirMgrinto two "classes", the original one and a more lightweight "subclass" which contains only some code to load directory information from raw data and to use it in the other parts of the library, but without the code to refresh the data periodically from the network.