router_pick_trusteddirserver_impl should distinguish between fallbacks and authorities
router_pick_directory_server_impl currently prioritises directories in the following order:
- tunneled
- mirrors
- overloaded mirrors
- authorities (trusted)
- direct
- mirrors
- overloaded mirrors
- authorities (trusted)
But router_pick_trusteddirserver_impl uses the following order:
- tunneled
- fallbacks + authorities
- overloaded fallbacks + authorities
- direct
- fallbacks + authorities
- overloaded fallbacks + authorities
I suggest we change it to:
- tunneled
- fallbacks
- overloaded fallbacks
- authorities
- direct
- fallbacks
- overloaded fallbacks
- authorities
We should do this for consistency, and to help with #17847 (moved) (unifying these two functions).
(This doesn't make much practical difference, because authorities are weighted 1.0, and fallbacks are weighted ~100,000.0, so authorities get selected very rarely. However, this would modify the effect of the DirAuthorityFallbackRate torrc option.)
If we do this, let's refactor the code so it's all in one place, probably using a macro.