aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdir/src/weight.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-1/+1
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* tor-netdir: port to web-time-compat.Nick Mathewson2026-03-261-1/+2
|
* RelayFlags: Use RelayFlag enum variant names everywhereIan Jackson2025-11-181-6/+6
| | | | | | | 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-7/+7
| | | | | | | | | | | | | | 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...
* tor-netdoc: Rename RelayFlags elements for regularity vs specIan Jackson2025-11-181-2/+2
| | | | | Add underscores so that the spec keywords and the flag constants correspond (according to `paste`'s case-changing rules).
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* tor-netdoc: Apply much rustfmt churnIan Jackson2025-08-261-1/+1
|
* tor-netdoc: Combine ConsensusRouterStatus and GenericRouterStatusIan Jackson2025-08-261-3/+3
| | | | Now we only need one type.
* tor-netdoc: Remove generics from Consensus and its contentsIan Jackson2025-08-261-1/+1
|
* tor-netdoc: netstatus: Move everything variety-specificIan Jackson2025-08-261-2/+2
| | | | | | | | | This is much code motion. This splits many types into two. For example, `Conensus` is now`plain::Consensus<RS>` and `md::Consensus<RS>`. We're going to get rid of the generics later in this branch.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-13/+10
| | | | | | | | | | | | | | 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.
* hs: Prevent a client from using a `MiddleOnly` relay for onion servicesNeel Chauhan2025-05-201-5/+3
| | | | | | > The actual impact of this patch is to prevent usage of MiddleOnly > relays as Introduction Points. The Rendezvous Point logic isn't > hooked up yet - nick
* netdir: fix warning about an opportunity to use saturating_subNick Mathewson2025-05-151-5/+1
|
* netdir: Add a note about using f64Nick Mathewson2025-03-251-0/+8
|
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-2/+2
| | | | - The Rng::gen() functions have been renamed to Rng::random().
* Use uXX::MAX in place of std::uXX::MAXNick Mathewson2024-04-221-3/+3
| | | | | | The old code produced a warning from clippy nightly; we may as well update to use the new associated consts. (They've been there since Rust 1.4x.)
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* netdir: Explain why there is no HsRend WeightRule.Nick Mathewson2024-01-141-1/+5
|
* tor-netdir: Add TODO about WeightRole::HsRendIan Jackson2023-08-291-0/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1550#note_2936400
* tor-netdir: Support for seleting HS intro pointsIan Jackson2023-08-291-0/+3
| | | | | | I'm quite unsure about this. Hence the TODOs. I think the API is right, though.
* 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
|
* Upgrade to bitflags 2.0Nick Mathewson2023-03-131-1/+2
| | | | | This version of bitflags now requires us to explicitly list the traits that we want to derive for our bit-flags structs.
* tor-netdir: Provide ConsensusRelays extension traitIan Jackson2023-02-011-3/+4
| | | | | Call it everywhere instead of the inherent method on MdConsensus. (Verified by ad-hoc temporarily renaming MdConsensus::relays().)
* 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.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* Resolve the new `derive_partial_eq_without_eq` lint.Nick Mathewson2022-05-231-1/+1
| | | | It's a little overzealous sometimes, but it's mostly to the good.
* Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-1/+0
|
* use wallclock where possible in teststrinity-1686a2022-02-261-0/+1
|
* tor-netdir: Resolve an XXXX about type uglinessNick Mathewson2021-12-081-4/+5
| | | | | | | | | | | | | | | We had no function to infallibly convert BoundedInt32<{0 or 1},H> into a u32, even though we could have. Because of that, we were treating weight_scale as an i32 when logically it's a u32 or a NonZeroU32. Moreover, it turns out we were using an incorrect minimum for the bwweightscale param, which would in theory have allowed the authorities to make us divide by zero. This patch introduces the necessary From<> implementation and uses it. It corrects the binimum bwweightscale, and prevents a division-by-zero issue in case weight_scale is zero.
* tor-netdir: Use bitflags for WeightKindNeel Chauhan2021-11-301-34/+49
|
* Merge remote-tracking branch 'origin/mr/71'Nick Mathewson2021-09-081-0/+1
|\
| * fix/silence clippy lints in test modulesDaniel Eades2021-09-081-0/+1
| |
* | Add validation function to WeightSetNick Mathewson2021-09-081-1/+18
|/ | | | | Our relay selection code can give wrong answers if we overflow u64::MAX, so let's make sure we never do that.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+625
This will cause some pain for now, but now is really the best time to do this kind of thing.