summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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
| |
* | BridgeDescEvent: Change the sole variant to SomethingChangedIan Jackson2022-10-251-5/+17
|/ | | | And explain what this all means.
* Merge branch 'guards_as_bridges_part1' into 'main'Nick Mathewson2022-10-248-135/+255
|\ | | | | | | | | Allow GuardMgr to expose bridges as guards (part 1) See merge request tpo/core/arti!785
| * guardmgr: Refactor the interior of FirstHop.Nick Mathewson2022-10-244-45/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | Now it contains either an `OwnedChanTarget` or an `OwnedCircTarget`, which will let `GuardMgr` return bridges that can be used to make circuits. As part of this change, it was necessary to revise some address-modification functions that applied to filters and `OwnedChanTarget`. Now they do the smart thing, and remove only the address that are in the `ChanMethod`. This means that the addresses from HasAddrs are still accurate about which addresses the relay "has".
| * guardmgr: Hold FallbackDir in fallback::set::EntryNick Mathewson2022-10-213-43/+61
| | | | | | | | This resolves an old TODO, and will simplify our work a little.
| * guardmgr: Add bridges sample, encode sample ID in FirstHopId.Nick Mathewson2022-10-215-52/+88
| | | | | | | | | | | | | | | | | | | | | | | | The most important part of this commit is to make sure that each `FirstHopId` includes the `GuardSetSelector` from which the guard was selected. Doing this lets us be certain that when we report that a guard has succeeded or failed, we're reporting it in the right context. Additionally, this commit uses strum to make an iterator over the samples, so that we can make sure that our "for each sample" code is robust against future changes, and we don't miss the bridge sample.
* | tor-guardmgr: descs: Make BridgeDescError DynCloneIan Jackson2022-10-212-1/+5
| |
* | tor-guardmgr: descs: Make BridgeDescError into a traitIan Jackson2022-10-211-4/+15
|/
* Merge branch 'bridge-internal-apis' into 'main'Ian Jackson2022-10-201-3/+12
|\ | | | | | | | | Use BridgeConfig to identify bridges in two places See merge request tpo/core/arti!781