| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| |
|
|
| |
Removed unnecessary lint
|
| |\
| |
| |
| |
| | |
tor-netdoc: Remove document hash from Microdesc struct (and add MicrodescAndHash for that)
See merge request tpo/core/arti!4138
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The Microdesc type having a copy of the document hash was always
weird, and it's weirder now that there's all these parse2 types that
don't have it and parse2 derives on Microdesc that don't touch it.
Make a new type for the descriptor and its hash.
Use deref to arrange that the new type works almost like the old one.
Adjust the use lines in the dependencies to temporarily import
MicrodescAndHash as Microdesc.
|
| |/
|
|
| |
This commit wraps the port policies in an Intern.
|
| |
|
|
|
|
|
| |
"iter" wasn't an iterator per se. Changed it to "sampled_items", and
renamed other variables to call the items more generically "items" than
"relay", since the mixed usage was a little confusing, and the function
doesn't really know anything about relays.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
We have more useful context in the caller, `pick_n_relays`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tests our implementation of sampling to ensure the behavior is
as-expected. It also updates the implementation so that the tests pass
(It was broken when updating to rand 0.10; see
https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3426398).
This removes the direct testing of
`rand::IndexedRandom::sample_weighted`, since this is now an
impplementation detail of `pick_n_filtered_weighted`, which is itself
tested.
Verified that this fixes the case of sometimes not being able to select
a Guard in integration tests.
<https://gitlab.torproject.org/tpo/core/chutney/-/work_items/40057#note_3426299>
<https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3408157>
<https://gitlab.torproject.org/tpo/core/arti/-/work_items/2209>
|
| | |
|
| | |
|
| |
|
|
|
| |
This should be a no-op refactor to callers. It's a step towards
decoupling the weighting and filtering from the sampling.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
The `choose_weighted` behavior given an empty sequence isn't well
documented and has changed over time. Handle it ourselves for
consistency.
Currently, the `choose_weighted` behavior appears to be to return
WeightError::InvalidInput. This means the corresponding `is_empty`
branch when handling WeightError::InsufficientNonZero was never
exercised. (Though may have been with previous versions of the rand
crate).
|
| |
|
|
| |
Signed-off-by: David Goulet <[email protected]>
|
| |
|
|
|
| |
This also adds a test, just make sure creating a `Lifetime` with
voting interval = 0 is actually impossible (and stays that way).
|
| | |
|
| |
|
|
|
| |
It's better to return a `Bug` than to panic if the consensus valid-after
is invalid.
|
| | |
|
| |
|
|
| |
This is no longer used.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes Arti's SRV lifetime calculation for the case where the voting
interval != 1h, and the consensus doesn't have explicit timestamps for
the SRVs.
Credit goes to dgoulet for this fix!
See also [this thread], and #2458 for the broader context.
Closes #2522
[this thread]: https://gitlab.torproject.org/tpo/core/arti/-/work_items/2458#note_3401343
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This abolishes the NetDefn type, and turns DenseRangeDb into a map to
one or (optionally!) two types.
For the DBs we ship, which don't have asn information, this saves
about 2.5 MiB.
(It also probably saves a bit more, since the niche optimization
didn't apply to NetDefn as it existed before, since it tried
to distinguish Some(None,None) from None.)
|
| |
|
|
|
| |
This required correcting some errors in our previous
ersatz geoip databases.
|
| |
|
|
| |
In particular to help debug arti#1907
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |\
| |
| |
| |
| | |
tor-netdir: Add spec link to flag descriptions
See merge request tpo/core/arti!3768
|
| | | |
|
| | |
| |
| |
| | |
No need to over-engineer this, let's keep it simple.
|
| |/
|
|
|
|
|
|
|
|
|
| |
This commit adds a method called `is_flagged_exit` to `RelayDetails` in
order to check whether the node is considered to be usable as an exit or
not.
In the Tor VPN app, we need this feature for generating a list of exit
relays (per country). Right now, we do this in an incorrect way by only
checking on whether port 443 is in the exit policy, which is not a
sufficient criteria.
|
| |
|
|
|
|
|
|
|
| |
`clippy::collapsible_if` started triggering after bumping the MSRV to
1.88.
Since this triggers from a lot of places, and since there even are a
couple of instances where we explicitly allow `clippy::collapsible_ifs`,
I've opened #2342 for deciding what to do about it.
|
| |
|
|
| |
This adds the lint to all our crates.
|
| |\
| |
| |
| |
| |
| |
| | |
Refactor common code that builds circtargets for HS.
Closes #1223
See merge request tpo/core/arti!3530
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
This code was duplicated across hsclient and hsservice.
Logically, it belongs in netdir, since that's where we have the
latest required-protocol information, and the ability to look up
relays by IDs.
Closes #1223
|
| |/
|
|
|
|
|
|
|
| |
Fixes part of #2193.
(Edits from nickm: I selected the cases here that I could verify
were correct from immediate context.)
Edited-by: Nick Mathewson <[email protected]>
|
| |
|
|
|
|
|
| |
Abolish the constants with the transitional names.
This also abolishes the controversial name `H_S_DIR`, which Rust case
transformation rules generated from `HSDir`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
| |
I would do `#[deprecated]` but empirically that has no effect...
|
| |
|
|
|
| |
Add underscores so that the spec keywords and the flag constants
correspond (according to `paste`'s case-changing rules).
|
| |
|
|
| |
Run maint/add_warning
|