aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/sample.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-1/+0
|
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-guardmgr: Port to web_time_compat.Nick Mathewson2026-03-261-25/+26
|
* RelayFlags: Use RelayFlag enum variant names everywhereIan Jackson2025-11-181-1/+1
| | | | | | | Abolish the constants with the transitional names. This also abolishes the controversial name `H_S_DIR`, which Rust case transformation rules generated from `HSDir`.
* RelayFlags: Use the singular RelayFlag for naming individual flagsIan Jackson2025-11-181-2/+2
| | | | | | | | | | | | | | We're going to separate RelayFlag from RelayFlags. We could continue to provide a bunch of constant values for RelayFlags, for each individual type, but that would involve an ad-hoc derive, and would still be a bit of an unusual API. Instead, we're going to make ``RelayFlag` a normal enum. In this commit, we change everyone to refer to it by its singular name. Hopefully separating out this bulk change makes both this, and the core commit, easier to review.
* tor-netdoc: Remove the RelayFlags type alias in netstatusIan Jackson2025-11-181-1/+2
| | | | I would do `#[deprecated]` but empirically that has no effect...
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-dirmgr, tor-guardmgr: Use std::slice::from_ref as suggested by clippy.Gabriela Moldovan2025-07-071-2/+2
|
* guardmgr: Fix clippy warning about needlessly owned cow.Nick Mathewson2025-05-151-1/+1
|
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - Several methods have been moved out of SliceRandom.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* tor-netdir: Allow access to the `ConsensusBuilder` when building test netdirs.Gabriela Moldovan2024-09-091-3/+3
| | | | | This allows us to set SRVs for example (needed because by default, the test `NetDir` is built from a consensus that doesn't contain any SRVs).
* Remove all *Relay is_flagged_guard methods.Nick Mathewson2024-03-281-3/+3
| | | | These were only used for testing.
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-5/+12
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* guardmgr: Stop using now-needless retain_mut crate.Nick Mathewson2023-11-301-4/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* "Fix" remaining unchecked-subtraction warnings.Nick Mathewson2023-01-271-1/+3
| | | | | In both cases I think it's fine to panic; but it's best to do so explicitly.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Merge branch 'remove_deadcode_allow' into 'main'Nick Mathewson2022-11-231-1/+0
|\ | | | | | | | | guardmgr: Remove a now-unneeded "allow(dead_code)" See merge request tpo/core/arti!862
| * guardmgr: Remove a now-unneeded "allow(dead_code)"Nick Mathewson2022-11-161-1/+0
| |
* | GuardMgr: split Reachable::Unknown into Untried and RetriableNick Mathewson2022-11-171-3/+5
|/ | | | | | | | There are two cases here, and we will want to log them differently. (By removing the "Unknown" variant entirely, we ensure that we didn't miss any code that formerly checked for Unknown.)
* GuardSet: Add a method to report which bridge descs we want.Nick Mathewson2022-11-141-0/+37
|
* GuardMgr: remove redundant call to extend_sample_as_neededNick Mathewson2022-11-101-3/+3
| | | | | | | | | | | | | | Previously we would call extend_sample_as_needed in only two places, one of which called the other unconditionally. That's obviously not necessary. I've selected just one of them (`update_guardset_internal`) since it fits better with the theme if that function. I've added comments explaining what is going on. This commit also introduces a yes/no enum for "were any guards added while extending this set". Formerly we had a boolean, but it got passed around so many times that I think its intent became obscure.
* GuardMgr: rename n_primary_without_dir_infoNick Mathewson2022-11-101-3/+8
| | | | | | | | | | | What this function actually does is return the number of primary guards whose presence (by identity) is ambiguous in a current universe. The new name and documentation should help avoid confusion. The method's old name had led me astray when identifying whether it should apply to bridges in one case. This commit also removes the corresponding `TODO pt-client`.
* GuardMgr: Fix build with bridge-client disabled.Nick Mathewson2022-11-081-0/+1
|
* GuardMgr: Remove no-longer-relevant `TODO pt-client` commentsNick Mathewson2022-11-081-4/+0
| | | | | Also remove a bunch of now-unnecessary `allow(dead_code)` annotations.
* GuardMgr: Pass correct universe to "Bridges" `GuardSet`.Nick Mathewson2022-11-081-1/+1
| | | | | | 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.
* 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: Fix and improve comments based on review.Nick Mathewson2022-11-021-1/+1
|
* guardmgr: fix rustdoc references.Nick Mathewson2022-11-021-1/+1
|
* guardmgr: Refactor candidate info; add `full_dir_info`Nick Mathewson2022-11-021-7/+7
| | | | | | | 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: Universe API should look up by ChanTargetNick Mathewson2022-11-021-1/+1
| | | | This will be necessary for bridges.
* guardmgr: take sampled guards from Universe.Nick Mathewson2022-11-021-65/+33
| | | | This is a trickier case, since we have to deal with weights.
* guardmgr: Continue porting porting code to use Universe.Nick Mathewson2022-11-021-9/+8
| | | | Two more simple cases that can use Universe instead of Netdir.
* guardmgr: Begin to decouple guards from NetDir.Nick Mathewson2022-11-021-1/+5
| | | | | | | | | | | | | | | 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: Allow guards to be constructed from any ChanTarget.Nick Mathewson2022-11-021-1/+1
|
* guardmgr: Rename and clarify of non-persistent-state copy fnsNick Mathewson2022-10-271-27/+5
| | | | 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-251-6/+18
| | | | | | | | | 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-251-98/+159
| | | | | | | | | | | | 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).
* guardmgr: Add bridges sample, encode sample ID in FirstHopId.Nick Mathewson2022-10-211-4/+11
| | | | | | | | | | | | 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.
* fix a couple of spelling errors in guardmgrNick Mathewson2022-10-191-1/+1
|