aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* 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-271-1/+6
| | | | | | | | 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-247-135/+254
|\ | | | | | | | | 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-214-52/+87
| | | | | | | | | | | | | | | | | | | | | | | | 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-211-1/+4
| |
* | 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
| * bridge descriptors: Change types of the descriptor cacheIan Jackson2022-10-201-3/+12
| | | | | | | | | | | | | | Now keyed by Arc<BridgeConfig>, and the values can be errors. Currently there is no implementation so there can't be any errors, but the error enum will become nonempty.
* | impl ChanTarget etc. for BridgeConfigIan Jackson2022-10-201-1/+17
|/
* fix a couple of spelling errors in guardmgrNick Mathewson2022-10-192-2/+2
|
* Merge branch 'readmes' into 'main'Nick Mathewson2022-10-121-93/+1
|\ | | | | | | | | | | | | Abolish maint/readme and use doc include Closes #603 See merge request tpo/core/arti!768
| * cargo fmt to remove blank linesIan Jackson2022-10-121-1/+0
| | | | | | | | | | | | | | Apparently cargo fmt doesn't like these, which my perl rune didn't delete. This commit is precisely the result of `cargo fmt`.
| * Replace all README copies in src/lib.rs with includesIan Jackson2022-10-121-92/+1
| | | | | | | | | | | | | | | | The feature we want is `#[doc = include_str!("README.md")]`, which is stable since 1.54 and our MSRV is now 1.56. This commit is precisely the result of the following Perl rune: perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
* | struct BridgeConfig: Rename from BridgeIan Jackson2022-10-123-17/+17
| | | | | | | | Fixes #599
* | struct Bridge: add ref to ticketIan Jackson2022-10-121-1/+1
|/
* tor-guardmgr: Export BridgeParseError from toplevelIan Jackson2022-10-121-1/+1
| | | | | Callers could `use` it as `tor_guardmgr::config::BridgeParseError` but it seems unecessary to force them to.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-122-0/+2
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-112-8/+14
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* tor-guardmgr: Fix build without pt-client featureIan Jackson2022-10-111-1/+3
|
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-1/+7
| | | | These are now builders.
* Begin revising HasAddr and its relationship to ChanTargetNick Mathewson2022-10-064-1/+21
| | | | | | | | | | | | | | | | | | | HasAddr used to mean "Here are addresses that I have, at which I can be contacted." But "Where (and how) can I be contacted?" is now a question for HasChannelMethod to answer. (We still need to have "HasAddr", though, so we can answer things like "what country is this relay in" and "are these relays in the same /8?") So this commit introduces: * A new trait for adding an implementation of HasChannelMethod in terms of HasAddr. * A requirement on ChanTarget that it needs to implement HasChannelMethod. There is some temporary breakage here, marked with "TODO pt-client", that I'll fix later in this branch.
* Merge branch 'bridge_containers' into 'main'Nick Mathewson2022-10-064-60/+166
|\ | | | | | | | | Start implementing more data structures to hold Bridge descriptors. See merge request tpo/core/arti!755
| * Extend some comments about bridge descriptorsNick Mathewson2022-10-062-2/+11
| |
| * Add a temporary HasAddrs for BridgeRelayNick Mathewson2022-10-041-1/+10
| | | | | | | | See comment for an explanation of the next issue here.