Refactor/Simplify to clarify "we cache dir info" vs "we invite clients to use us as a directory guard"
I was trying to work on #21676 (moved), and I got lost in a twisty little maze of "router_should_be_directory_server" and "dir_server_mode" and "decide_to_advertise_dir_impl" and "decide_to_advertise_begindir" and "directory_caches_dir_info" and "directory_permits_begindir_requests" and etc.
I think there are two main concepts here:
-
(1) Do we want to fetch all the directory info that a directory mirror would fetch? (If we do, we should cache it, and we might as well serve it.)
-
(2) Do we want to invite clients to use us as their directory mirror? (Whether clients actually do use us is up to whether the directory authorities tell them to.)
For (1), a lot of relays already do the fetching, e.g. so they can answer connection_or_digest_is_known_relay(), so maybe we are really close to declaring that the answer for any relay is yes. (See also Proposal 237, where we thought we did this step.) That would sure simplify things.
For (2), we're moving toward a world where only fallback mirrors and directory guards get asked these questions, so it's cheap to offer, since it's then up to the directory authorities to only take us up on it if they think we're a good fit.