summaryrefslogtreecommitdiff
path: root/crates/tor-hsclient/src/connect.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-hsclient: connect.rs: Remove a redundant map_errIan Jackson2026-07-231-2/+1
|
* HsDesc::parse_decrypt_validate: Don't check validity timeIan Jackson2026-07-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This function returns a `TimeRangeBound`. That implies a responsibility on the caller to check the time. It doesn't make sense for this function to do the check as well. But, it turns out that in tor-hsclient, the `TimeRangeBound<HsDesc>` is sometimes processed with `.dangerously` on the assumption that it was checked earlier. I considered changing this, and storing plain `HsDesc` and a separate `TimeRange` - but that's not right, because there are places where the `TimeRangeBound<HsDesc>` is used well after it was verified. Instead, in this commit, I (effectively) move the `.check_valid_at` call from `parse_decrypt_validate` to its principal call site. This involves a change to the error representation. Previously, validity time errors ended up as `DescriptorErrorDetail::Descriptor` containing an `HsDescError::OuterValidation` HsDescError:: InnerValidation`, which in turn contains a `tor_netdoc::Error`. (`tor_netdoc::Error` is a rather awkward type.) Now we have our own error variant. The overall behaviour is unchanged.
* tor-checkable: Rename `TimeBound::check_valid_*` to `if_valid_*`Ian Jackson2026-07-231-2/+2
| | | | | | | I find these names confusing. To my mind "check" implies a function returning `Result<(), _>`. Some other APIs use `unwrap` here but I think `if` is good.
* tor-checkable: TimeRangeBound: Rename bounds to bounds_start_endIan Jackson2026-07-231-2/+2
| | | | | | | | | | This just returns a tuple. We're going to introduce a new method that returns a `TimeRagne` and will want to be called `bounds`. That method will want to be in the `TimeBound` trait, but for now we add it here. Various call sites will be added in forthcoming commits.
* Use new TimeRangeBound name throughout the treeIan Jackson2026-07-161-4/+4
|
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-1/+1
|
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-2/+0
|
* Removed unnecessary lintpryty262026-07-151-1/+1
| | | | Removed unnecessary lint
* Change HS descriptor sendme_inc into a NonZeroU8Nick Mathewson2026-07-021-1/+1
| | | | | This saves us from having to check whether it is 0, and better represents what the type is allowed to be.
* hsclient: Support protocol negotiation for CGO and flowctrl-ccNick Mathewson2026-07-021-12/+53
|
* 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.
* hsclient: s/cur_revision/stored_revision for clarityGabriela Moldovan2026-05-071-4/+4
| | | | "Stored" is more accurate than "current".
* hsclient: Compare the time periods instead of the blinded HsIdsGabriela Moldovan2026-05-071-6/+7
| | | | | | | The blinded HsIds were used a proxy for the time periods, but it's better to just compare the TPs directly. Part of #966
* hsclient: Store the current time period in a variable (fmt)Gabriela Moldovan2026-05-071-2/+1
|
* hsclient: Store the current time period in a variableGabriela Moldovan2026-05-071-3/+4
| | | | This will soon need to be copied into `HsDescForTp`.
* hsclient: Fix an off-by-one checkGabriela Moldovan2026-05-071-1/+1
| | | | | | We no longer consider the HsDir rate-limited if its `requery == now`. This was caught by the new tests.
* hsclient: Add test for introduction retries after intro NACKGabriela Moldovan2026-05-071-5/+113
|
* hsclient: Add scope around mutex guard (fmt)Gabriela Moldovan2026-05-071-8/+8
|
* hsclient: Add scope around mutex guardGabriela Moldovan2026-05-071-0/+2
| | | | | This needs to be dropped before the next test (because the test will try to acquire the lock inside the `Mocks` impl).
* hsclient: Move test descriptor parsing and decryption to a new functionGabriela Moldovan2026-05-071-18/+21
|
* hsclient: Move HsClientDescEncKeypair building to a new functionGabriela Moldovan2026-05-071-6/+8
| | | | | | We need to build this twice per test (because keypairs aren't `Clone`). I find that putting boilerplate like this in a separate function makes the tests more legible.
* hsclient: Move test netdir setup to a new functionGabriela Moldovan2026-05-071-6/+9
| | | | | I'm trying to reduce the cognitive load of the test a bit, because I will soon extend it so it will grow even more complex.
* hsclient: Make the mock introduce ACKs configurableGabriela Moldovan2026-05-071-6/+17
|
* hsclient: Replace fully-qualified paths with import aliasGabriela Moldovan2026-05-071-13/+11
| | | | I find very long paths a bit hard to read..
* hsclient: Remove no longer applicable commentGabriela Moldovan2026-05-071-2/+0
| | | | The line the comment is referring to for no longer exists.
* hsclient: Unwrap the connect result in testGabriela Moldovan2026-05-071-1/+1
| | | | To ensure it's actually `Ok(())` like we expect.
* hsclient: Remove no longer needed clippy allows in testsGabriela Moldovan2026-05-071-4/+0
|
* hsclient: Remove no longer needed panic handling logic (fmt)Gabriela Moldovan2026-05-071-2/+1
|
* hsclient: Remove no longer needed panic handling logicGabriela Moldovan2026-05-071-4/+2
| | | | `connect()` no longer panics, so we don't need it anymore.
* hsclient: Implement some more of the mock test implsGabriela Moldovan2026-05-071-8/+47
|
* hsclient: Mock the rendezvous handshakeGabriela Moldovan2026-05-071-13/+59
| | | | | Doing this means we wont't need to go through the trouble of building a valid `Rendezvous2` cell in the tests.
* hsclient: Remove unused test functionGabriela Moldovan2026-05-071-9/+0
| | | | | This is used, and is getting in the way a little bit, so I am removing it.
* hsclient: Only compare revision counters for the same TPGabriela Moldovan2026-05-071-20/+8
| | | | | | | If the blinded id has changed since we cached our descriptor, it means the TP has changed, and so we can assume the new descriptor is fresher. Part of #966
* hsclient: Store the HsBlindId alongside the HsDescGabriela Moldovan2026-05-071-4/+23
| | | | | | This enables us to tell whether a newly fetched descriptor's revision counter can be compared with the revision counter of our cached descriptor.
* circmgr,hsclient: s/requery_period/requery_intervalGabriela Moldovan2026-05-071-4/+4
| | | | C Tor calls this a "period", but "interval" is more accurate.
* hsclient: Retain the rust bug link for the borrowck issuesGabriela Moldovan2026-05-071-0/+5
|
* hsclient: Address a clippy suggestion (fmt)Gabriela Moldovan2026-05-071-10/+8
|
* hsclient: Address a clippy suggestionGabriela Moldovan2026-05-071-3/+2
|
* hsclient: Remove TODO suggesting a wrong changeGabriela Moldovan2026-05-071-5/+0
| | | | | | As David mentioned in a review comment, we don't want to refetch the descriptor unless *all* introduction attempts have failed. See https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3925#note_3402810
* hsclient: Reach out to all HsDirs if we have no descriptorGabriela Moldovan2026-05-071-3/+10
| | | | | | | | | | | | | | | If the client doesn't have a timely cached descriptor, then ignore the requery period and reach out to all the HsDirs of the service. This can, in theory, cause the client to unnecessarily query the HsDirs when its cached descriptor has expired, but this would be a very rare event, because the descriptor is long lived. I'm carving out this exception to the usual rate-limiting behavior, because I suspect having the client more eagerly reattempt the connection will be better for UX, (by the time the client's descriptor expires, the service, assuming it's still online, is expected to have published a new one, so IMO it makes sense to try to fetch it).
* hsclient: Rate-limit HsDir re-querying (fmt)Gabriela Moldovan2026-05-071-9/+11
|
* hsclient: Rate-limit HsDir re-queryingGabriela Moldovan2026-05-071-9/+66
| | | | | | | | | | | | Because we now refetch HsDirs on introduce NACK, we need some type of rate-limiting to prevent clients from hammering the HsDirs if the service is offline. This rate-limiting is per-HsDir: the client will avoid querying the same HsDir more frequently than `hs_dir_requery_period`. The HsDir requery info is stored in the new `DataHsDirs` map. Part of #966
* hsclient: Rename intro_target to ids (fmt)Gabriela Moldovan2026-05-071-3/+1
|
* hsclient: Rename intro_target to idsGabriela Moldovan2026-05-071-4/+4
| | | | This is no longer an `&OwnedChanTarget`, so I'm renaming it accordingly.
* hsclient: Make RelayIdFor impl generic over T: HasRelayIdsGabriela Moldovan2026-05-071-2/+2
| | | | | | | The new `RelayIdFor` type alias I'm about to add will need to call `RelayIdFor::{for_lookup, for_store}` with a type that isn't `&OwnedChanTarget`, so I will need these functions to take a generic `HasRelayIds`.
* hsclient: Add a generic RelayIdFor for storing relay informationGabriela Moldovan2026-05-071-5/+29
| | | | | | | | This refactors `RelayIdForExperience` into a more generic `RelayIdFor` type. `RelayIdFor` will serve the basis for another key type that will be used for storing `HsDir` information.
* hsclient: Update comment about hsdesc caching, add TODOGabriela Moldovan2026-05-071-3/+21
|
* hsclient: Use Option<> combinators to get rid of branching (fmt)Gabriela Moldovan2026-05-071-8/+11
|
* hsclient: Use Option<> combinators to get rid of branchingGabriela Moldovan2026-05-071-4/+2
| | | | | | I find having too many of these nested `else { None }` branches makes the overall logic harder to follow, so I changed this to use `Option<>` combinators instead.