aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr
Commit message (Collapse)AuthorAgeFilesLines
...
* | GuardMgr: Add UniverseType to make code more explicit.Nick Mathewson2022-11-081-7/+28
| | | | | | | | | | | | Instead of duplicating the logic about which guard sample uses which universe, we explicitly ask it, and then use that universe. This will avoid trouble if/when we introduce more samples.
* | GuardMgr: Launch a background task to keep the list of bridgeNick Mathewson2022-11-082-1/+38
| | | | | | | | descriptors updated as appropriate.
* | GuardMgr: Exit keep-netdir-updated task early if GuardMgr disappears.Nick Mathewson2022-11-081-0/+2
| |
* | GuardMgr: Pass correct universe to "Bridges" `GuardSet`.Nick Mathewson2022-11-084-15/+115
| | | | | | | | | | | | This can probably be done in a simpler way, but for the moment I would prefer to try to minimize the amount of code I'm changing here.
* | GuardMgr: Change BridgeSet, BridgeRelay to use more referencesNick Mathewson2022-11-082-29/+27
| | | | | | | | | | | | | | This will match our needs better and help avoid some `Arc<>`s. It will be especially helpful for avoiding `Arc`s we don't actually have.
* | GuardMgr: Store bridge configuration.Nick Mathewson2022-11-081-15/+56
| | | | | | | | | | | | | | | | | | | | I'm using an Arc<[]> here though I think that there's a chance that a simple Vec<> would suffice. Since it's an internal type, nothing will break if we change it later. Also, we now switch into and out of the Bridges guard sample as needed. However, that selection is not (yet) built from the list of bridges. That will come soon.
* | GuardMgr: Remove duplicate code in set_filterNick Mathewson2022-11-081-13/+2
| |
* | GuardMgr: Clarify intent with update_active_set.Nick Mathewson2022-11-081-4/+5
| | | | | | | | Also fix its behavior when using bridges.
* | GuardMgr: Split `update_internal` into two functions.Nick Mathewson2022-11-081-27/+50
| | | | | | | | | | | | The first part changes which guard set is active based on based on the parameters, which always come from a NetDir; the second changes the contents of the active guard set, based on a Universe.
* | Refactor external guardmgr APIs: Stop taking NetDir arguments.Nick Mathewson2022-11-083-59/+46
| | | | | | | | | | | | | | | | | | These arguments were used only for legacy (testing) purposes; the tests now use `TestNetDirProvider`. This lets us simplify our internal logic for passing a `NetDir` to our samples, and prepare for having a `BridgeSet` to pass there instead. This is a breaking change to `guardmgr` and `circmgr`.
* | Add an accessor for the latest BridgeDescList.Nick Mathewson2022-11-081-0/+12
| |
* | Implement GuardMgr::install_bridge_desc_providerNick Mathewson2022-11-081-6/+25
| |
* | Require Send+Sync for BridgeDescProviderNick Mathewson2022-11-081-1/+1
| | | | | | | | We require these for NetDirProvider, so this shouldn't be a big reach.
* | bridge desc: Make BridgeDescProvider DynCloneIan Jackson2022-11-071-1/+3
| | | | | | | | | | This allows the use of Box<dyn BridgeDescProvider> in callers, since Box<dyn BridgeDescProvider> is now Clone.
* | Fix typosDimitris Apostolou2022-11-061-2/+2
|/
* Merge branch 'warning' into 'main'Nick Mathewson2022-11-031-1/+1
|\ | | | | | | | | tor-guardmgr: use imported WeightThreshold in one place See merge request tpo/core/arti!825
| * tor-guardmgr: use imported WeightThreshold in one placeIan Jackson2022-11-031-1/+1
| | | | | | | | | | Without this, an unused import warning is generated when building without features.
* | guardmgr config: Provide bridge information to new and reconfigureIan Jackson2022-11-032-1/+25
| |
* | bridges config: Provide uninhabited placeholderIan Jackson2022-11-031-0/+14
| | | | | | | | | | This will avoid having to make bridge-related trait features in GuardMgr conditional, which would be non-additive.
* | guardmgr config: Introduce and require new GuardMgrConfig traitIan Jackson2022-11-033-11/+66
| | | | | | | | | | It doesn't seem to me like it makes sense to provide the backward compatibility here.
* | guardmgr config: Pass fallback list from config by referenceIan Jackson2022-11-032-11/+11
|/ | | | | This does involve additional cloning. However, soon it will mean that we can pass the whole `TorClientConfig` by reference.
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* Require derive_more 0.99.3Ian Jackson2022-11-031-1/+1
| | | | | | | | 0.99.[012] have a bug https://github.com/JelteF/derive_more/issues/114 which makes the Deref derive for bridgedesc::StateGuard not work and therefore breaks minimal-versions CI. It seems simpler to require the newer version everywhere.
* Merge branch 'guards_as_bridges_part3' into 'main'Nick Mathewson2022-11-026-156/+559
|\ | | | | | | | | GuardMgr: decouple NetDir from guards and sample code. See merge request tpo/core/arti!815
| * Refactor CandidateStatus API to simplify code in descs.Nick Mathewson2022-11-022-30/+35
| | | | | | | | This removes some duplication.
| * GuardMgr: Fix and improve comments based on review.Nick Mathewson2022-11-023-6/+13
| |
| * guardmgr: fix rustdoc references.Nick Mathewson2022-11-022-3/+3
| |
| * guardmgr: Refactor candidate info; add `full_dir_info`Nick Mathewson2022-11-024-30/+72
| | | | | | | | | | | | | | Previously we always set `dir_info_missing` to `false` for new guards, since new guards could only be taken from ones that were present in the NetDir. But for bridges, we don't download their info until _after_ we have chosen them as guards.
| * guardmgr: Implement Universe for bridges.Nick Mathewson2022-11-023-2/+161
| | | | | | | | | | Now we can use a group of bridges as the basis for a sample of guards.
| * guardmgr: Universe API should look up by ChanTargetNick Mathewson2022-11-023-14/+13
| | | | | | | | This will be necessary for bridges.
| * guardmgr: take sampled guards from Universe.Nick Mathewson2022-11-023-83/+140
| | | | | | | | This is a trickier case, since we have to deal with weights.
| * guardmgr: Continue porting porting code to use Universe.Nick Mathewson2022-11-022-12/+11
| | | | | | | | Two more simple cases that can use Universe instead of Netdir.
| * guardmgr: Begin to decouple guards from NetDir.Nick Mathewson2022-11-023-38/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this and the upcoming commits I'll be changing how guards related to `NetDir` and to `Relay`. Previously, a guard could only come from (or be updated from) a `Relay` in a `NetDir`. Soon it will be able to be built from a bridge as well. To do this, I'm defining a `Universe` trait (name negotiable) that represents a set of things that may be guards. I'm going to continue extending its functionality until there are no more methods in guard.rs or sample.rs that take `NetDir`. This commit removes most of the usage of `NetDir` and `Relay` in `guard.rs`.
| * guardmgr: Rename microdescriptor_missing to dir_info_missingNick Mathewson2022-11-021-9/+9
| |
| * guardmgr: Allow guards to be constructed from any ChanTarget.Nick Mathewson2022-11-022-7/+16
| |
| * guardmgr: Include PtTarget in guards.Nick Mathewson2022-11-021-8/+50
| | | | | | | | | | Use a vector, since we may (someday) want to allow a Guard to have multiple PtTargets.
* | remove unused dependanciestrinity-1686a2022-10-291-1/+0
|/
* Merge branch 'guards_as_bridges_part2' into 'main'Nick Mathewson2022-10-274-141/+317
|\ | | | | | | | | Use ByRelayIds to hold guards in GuardSet See merge request tpo/core/arti!808
| * guardmgr: Rename and clarify of non-persistent-state copy fnsNick Mathewson2022-10-273-32/+24
| | | | | | | | These will need a bigger overhaul: see #612 and #611.
| * Clarify fix_consistencyIan Jackson2022-10-271-2/+2
| |
| * Clarify what it means to be "an identity" for a primary guard.Ian Jackson2022-10-271-1/+1
| |
| * tor-guardmgr: Add big doc comment about guard id handlingIan Jackson2022-10-271-0/+58
| |
| * guardmgr: Use new ambiguity-tolerant contains in state handlingNick Mathewson2022-10-251-2/+30
| | | | | | | | This has subtleties; the comments try to explain them.
| * guard sample: Change semantics of `contains` to handle ambiguity.Nick Mathewson2022-10-252-10/+33
| | | | | | | | | | | | | | | | | | This is necessary for the (somewhat undesirable) lookup_ids function to return an ID that the dirmgr can actually use to report successes and failures. As noted, lookup_ids will create problems down the road when we implement relays. We should refactor it out before then.
| * Replace contains_relay with can_add_relay().Nick Mathewson2022-10-251-9/+6
| | | | | | | | | | | | To see if we can add a relay as a guard, we need a conservative test: any IDs in common with the given relay prevent us from adding it.
| * Convert guard samples to use ByRelayIds.Nick Mathewson2022-10-253-124/+193
| | | | | | | | | | | | | | | | | | | | | | | | This required a number of changes, which I've tried to document. I've taken a conservative approach to modification, and I'm not using any of the by_*_mut() functions (yet). For cases which potentially modify the whole set, I'm using into_values() and collect() to ensure that it's re-indexed correctly, even though the identities don't change. I introduce some "TODO pt-client" comments here which I will resolve in the next commit(s).
| * impl HasRelayIds for GuardId.Nick Mathewson2022-10-251-0/+9
| |
* | BridgeDescProvider: Make BridgeDescEvent repr(u16) and derive traitsIan Jackson2022-10-272-1/+7
| | | | | | | | This will enable us to impl FlagEvent for it.
* | impl Hash for BridgeConfig and various PT informationIan Jackson2022-10-271-1/+1
| | | | | | | | | | The bridge descriptor manager wants to index data structures by the BridgeConfig.
* | tor-guardmgr: bridges: export BridgeDescError at toplevelIan Jackson2022-10-271-1/+1
| |