summaryrefslogtreecommitdiff
path: root/crates/tor-netdir/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdir: Warn on one more case of insufficient itemsNick Mathewson2025-04-291-1/+12
| | | | | | Now that choose_multiple_weighted can once more return fewer items than requested, we should warn when it does so, to be consistent with our other cases of warning about #1907.
* tor-netdir: test for rand 0.9.1 behavior instead of 0.9.0Nick Mathewson2025-04-291-3/+9
| | | | | | | | Rand 0.9.1 reverted the changes that caused #1903, in https://github.com/rust-random/rand/pull/1623. This broke our test that made sure that rand wasn't going to change their behavior _again_ :)
* Rename recommended_protocols to protocol_statuses.Nick Mathewson2025-04-161-3/+3
| | | | | This name reflects its purpose better than the original one, since it includes required protocols as well as recommended ones.
* netdir: Add a recommended_protocols() to NetDirProviderNick Mathewson2025-04-161-0/+10
|
* dirmgr, netdir: Store protocol requirments as soon as they are validated.Nick Mathewson2025-04-161-0/+4
|
* Fix another miscapitalized "MicroDesc"Nick Mathewson2025-04-161-1/+1
|
* netdir: Add a (hopefully) temporary workaroundNick Mathewson2025-03-251-3/+27
| | | | | Instead of doing the more sensible thing when every relay has weight 0, give a warning message.
* netdir: Another test for choose_multiple_weighted.Nick Mathewson2025-03-251-0/+17
| | | | | | Here we test the (arguably inconsistent behavior) where can we return fewer items than requested if no item had zero weight. (If this ever becomes an error, we need to modify the calling code.)
* netdir: Warn on unexpected WeightedErrorsNick Mathewson2025-03-251-5/+13
| | | | | | WeightedError::InsufficientNonzero is expected under some circumstances, but the other instances would mean that we have a bug.
* netdir: add a test to verify weighted samplingNick Mathewson2025-03-251-3/+37
| | | | | We want to make sure that behavior for 0-weighted elements is consistent for choose_multiple_weighted and choose_weighted.
* tor-netdir: Handle InsufficientNonZero error.Nick Mathewson2025-03-201-0/+8
| | | | Possible fix for #1902.
* 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
| | | | - The rand::distributions module has been renamed to rand::distr
* netdir: Consider RelayFamilyIds based on family rulesNick Mathewson2025-02-251-9/+9
| | | | | | | This implements the client side of proposal 321. It's a breaking change in netdir, since in_same_family now takes an extra argument.
* relay-selection: Add FamilyRules to exclude_relays_in_same_family.Nick Mathewson2025-02-251-0/+63
| | | | | | | | | | | | When we're trying to exclude relays by family, we need to know which lists to look at. This information ultimately comes from the network parameters. We could avoid this change if we just told clients "look at all family information all the time", but that's not what the proposal says. This is a breaking change.
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* Resolve clippy::empty_line_after_doc_comments warnings.Nick Mathewson2024-12-031-1/+0
| | | | These are new in Rust 1.83.
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* tor-netdir: Add timeliness param to wait_for_netdir_to_list.Wesley Aptekar-Cassels2024-11-251-1/+2
|
* Move helpers from tor-hsservice to tor-netdir.Wesley Aptekar-Cassels2024-11-251-1/+79
| | | | | These helpers seem potentially broadly useful, and only really discoverable if they're here.
* tor-netdir: Allow access to the `ConsensusBuilder` when building test netdirs.Gabriela Moldovan2024-09-091-7/+7
| | | | | 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).
* Fix new "clippy::needless-maybe-sized" warning on nightlyNick Mathewson2024-07-281-1/+1
| | | | | This warning complains when we say `where T: SomeTrait + ?Sized` when `SomeTrait` is inherently Sized.
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Doc: tweak documentation on NetDir::id*listed functionsNick Mathewson2024-04-101-10/+9
| | | | | Previously they were a bit confusing, and the public function explained its behavior in terms of the private one.
* Doc: Add xref from NetDir::by_ids to ids_listed.Nick Mathewson2024-04-101-0/+7
| | | | | | | Explain that `by_ids` isn't what you want if you need to know whether a relay _definitely_ doesn't exist. Closes #1365
* Fix some rustdoc links and copypaste errors in tor-netdir.Nick Mathewson2024-04-041-2/+2
|
* tor-netdir: Abolish Relay::has_same_relay_idsIan Jackson2024-04-031-10/+3
| | | | This was an open-coded specialisation. Remove the one call site.
* Move rs_is_dircache to details.rsNick Mathewson2024-03-281-6/+0
|
* Rename `Relay::same_relay` and make it private.Nick Mathewson2024-03-281-8/+6
| | | | | Everybody outside of tor-netdir should use HasRelayIds::same_relay_ids, whose intent is clearer.
* Remove all *Relay is_flagged_guard methods.Nick Mathewson2024-03-281-4/+2
| | | | These were only used for testing.
* Remove temporary functions in CheckedRelay.Nick Mathewson2024-03-281-169/+57
|
* Remove temporary functions in UncheckedRelay.Nick Mathewson2024-03-281-26/+6
|
* Move most functions from *Relay to *RelayDetailsNick Mathewson2024-03-281-0/+145
| | | | | | | | In *RelayDetails, this is just a matter of changing a bunch of `self`s to `self.0`. Additionally, I've added temporary stub functions to delegate to the new functions.
* Relocate declarations of *Relay methods to details.rsNick Mathewson2024-03-281-129/+1
| | | | This is 99% code movement.
* Add low_level_details to {Unchecked,}Relay.Nick Mathewson2024-03-271-0/+19
| | | | | | | | | | I'm going to use this wrapper type to hide checks that should mostly not be used without careful thinking. There are also comments here explaining when you'd want to use these types, and when you shouldn't. Part of #504.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* netdir: Add additional functionality to SubnetConfigNick Mathewson2024-03-121-1/+62
| | | | We'll need this to implement restrictions more reasonably.
* deny clippy::unchecked_duration_subtractiontrinity-1686a2024-02-291-0/+1
|
* Note a calculation we can clean up after doing spec work.Nick Mathewson2024-02-201-1/+3
|
* Add caveats on is_flagged_guard, and note possible deprecationNick Mathewson2024-02-201-1/+15
|
* Add and use "UncheckedRelay::is_suitable_as_guard"Nick Mathewson2024-02-201-0/+5
|
* Only pick Fast relays as introduction points.Nick Mathewson2024-02-201-1/+1
| | | | This matches the behavior of C tor. Part of #1100.
* Require that guards are Fast and Stable.Nick Mathewson2024-02-201-0/+5
| | | | | | This matches the behavior of C tor. Part of #1100.
* netdir: Add Relay::is_flagged_{fast,stable} methods.Nick Mathewson2024-02-121-0/+14
|
* tor-netdir: Make hs_dirs_{upload, download} take separate args instead of tuple.Gabriela Moldovan2024-01-241-2/+4
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1904#note_2987777
* tor-netdir: Simplify `hs_dirs_upload` by only returning the `Relay`.Gabriela Moldovan2024-01-241-20/+15
| | | | | | | | The publisher is the only user of `hs_dirs_upload`. It turns out it never actually uses the first element of the yielded `Item`s, so we can simplify `hs_dir_upload` to only return the HsDir `Relay`s. Part of #1166
* tor-netdir: Make hs_all_time_periods return HsDirParams.Gabriela Moldovan2024-01-241-3/+3
| | | | | | | | | The descriptor publisher uses this function to obtain the list of relevant time periods. It will soon also need to know the `srv_lifespan` associated with each time period, so we change this function to return `HsDirParams`. Part of #1166
* netdir: Make hs_dirs_upload() yield &HsDirParams.Nick Mathewson2024-01-231-2/+3
| | | | Closes #1254.
* Expose HsDirParams, and give it accessors.Nick Mathewson2024-01-231-1/+5
|
* netdir: Only choose Stable relays as introduction points.Nick Mathewson2024-01-161-3/+1
| | | | | | This implements Relay::is_hs_intro_point. Close #1240.