aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hsclient/src/err.rs
Commit message (Collapse)AuthorAgeFilesLines
* HsDesc::parse_decrypt_validate: Don't check validity timeIan Jackson2026-07-231-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* hsclient: Support protocol negotiation for CGO and flowctrl-ccNick Mathewson2026-07-021-0/+6
|
* hsclient: Rate-limit HsDir re-queryingGabriela Moldovan2026-05-071-0/+10
| | | | | | | | | | | | 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: Move and correct timeouts for hsdescriptor downloads.Nick Mathewson2026-05-071-0/+6
| | | | | | | | | The hspool operations already include their own timeouts, so we don't need to recalculate them. For the directory related operations, we now calculate the timeouts based on actual circuit lengths, and use those timeouts on the operations themselves.
* tor-hsclient: Report IPT index in IntroductionFailed.Wesley Aptekar-Cassels2025-11-251-1/+1
| | | | This would have made #2268 clearer to me.
* 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.
* hs*: Define some HsDesc errors as _suspicious_.Nick Mathewson2025-07-101-0/+16
| | | | | These errors are suspicious as hsdir inflation attacks, in the context of prop360.
* dirclient: New error type for too-long headers.Nick Mathewson2025-07-101-0/+1
| | | | (This was previously called a parse error, which isn't right.)
* hs-pow: Use TimerangeBound for puzzle parameters.Wesley Aptekar-Cassels2024-10-091-0/+22
| | | | Co-authored-by: Micah Elizabeth Scott <[email protected]>
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-1/+1
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* Preserve HTTP status text in dirclient errors.Nick Mathewson2023-11-291-1/+1
| | | | | | | | The HTTP status text is often useful for diagnosing errors. Tor directory and hsdir caches frequently put useful messages there, especially when rejecting an uploaded document. Inspired by #1142.
* Fix typosDimitris Apostolou2023-07-221-1/+1
|
* retry-error: Attempts must be AsRef<dyn Error>; print their sourcesIan Jackson2023-07-191-3/+3
| | | | | | | | The effect is that everywhere a RetryError is used, the error sources for the contained errors will be Display'd. In tor-hsclient we no longer need to explicitly wrap things up in tor_error::Report.
* Merge branch 'handshake-error' into 'main'Nick Mathewson2023-06-291-24/+48
|\ | | | | | | | | tor-hsclient: Handle handshake completion error correctly See merge request tpo/core/arti!1336
| * tor-hsclient: err: Mention RENDEZVOUS2 in actual messages (fmt)Ian Jackson2023-06-291-1/+3
| |
| * tor-hsclient: err: Rename to RendezvousCompletionCircuitErrorIan Jackson2023-06-291-4/+4
| | | | | | | | | | | | | | Thsi is a bit of a mouthful now, but it is comprehensible. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1336#note_2917235
| * tor-hsclient: err: Mention RENDEZVOUS2 in actual messagesIan Jackson2023-06-291-2/+2
| |
| * tor-hsclient: err: Move doc comment to correct implIan Jackson2023-06-291-17/+17
| | | | | | | | | | See https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1336#note_2917236
| * tor-hsclient: err: Mention RENDEZVOUS2Ian Jackson2023-06-291-2/+2
| |
| * tor-hsclient: err: Reword comments about errorIan Jackson2023-06-291-1/+1
| |
| * tor-hsclient: Handle handshake completion error correctlyIan Jackson2023-06-281-0/+21
| |
| * tor-hsclient: Rename RendezvousCompletionCircuit from RendezvousCompletionIan Jackson2023-06-281-4/+4
| | | | | | | | | | | | We need to handle errors during the handshake. That also produces a `tor_proto::Error` but we want to print a different message for that, so let's rename this before adding the new variant.
| * tor-hsclient: Move handling of Bug to new sectionIan Jackson2023-06-281-1/+2
| | | | | | | | It was wrong where ti was.
* | tor-hsclient: Make RendPtIdentityForError use RelayIdsIan Jackson2023-06-281-6/+3
| | | | | | | | Since arti!1233 this is trivial.
* | tor-hsclient: Use RendPtIdentityForError in more placesIan Jackson2023-06-281-4/+4
|/ | | | | For some reason this wasn't used in the actual errors, although it *was* used in the types of the functions etc.
* tor-hsclient: Completely hide hsdir identities in errorsIan Jackson2023-06-281-5/+4
|
* tor-hsclient: Expire old data eventuallyIan Jackson2023-06-231-0/+11
| | | | Otherwise we'll fill up our RAM with junk.
* Merge branch 'expire' into 'main'Ian Jackson2023-06-231-1/+1
|\ | | | | | | | | tor-hsclient: Expire circuits when they get too old See merge request tpo/core/arti!1287
| * tor-hsclient: linkify a URL in a doc commentIan Jackson2023-06-221-1/+1
| |
* | Remove onion service descriptor-related errorkinds.Nick Mathewson2023-06-221-2/+2
| | | | | | | | | | | | | | | | These have been subsumed by other errorkinds, mostly OnionServiceProtocolViolation and TorProtocolViolation. In particular please review the change in tor-hsclient closely; I am not sure about the new errorkinds for the error there.
* | netdoc: Introduce HsDescErrorNick Mathewson2023-06-221-30/+3
| | | | | | | | | | | | | | | | | | | | For higher-level HsDesc-related functions, this type indicates where exactly an error occurred. It lets us distinguish decryption errors from parsing errors, and attribute responsibility to the hsdir, the onion service, or the user's lack of encryption. This lets us remove some just-introduced complexity in tor-hsclient.
* | Generate correct ErrorKinds for hsdesc decryption failures.Nick Mathewson2023-06-211-1/+24
|/ | | | Part of #736
* tor-hsclient: Omit some unussed struct fields in patternsIan Jackson2023-06-211-2/+2
| | | | | For the arms that have a fixed retry time, or a fixed ErrorKind, dont't bind the unused inner error.
* tor-hsclient: provide intro_index accessor for FailedAttemptError (xref)Ian Jackson2023-06-151-1/+2
| | | | Add a cross-reference to docs arising from MR comments in !1246.
* tor-hsclient: provide intro_index accessor for FailedAttemptErrorIan Jackson2023-06-151-0/+24
|
* tor-hsclient: Add doc for HasKind for FailedAttemptErrorIan Jackson2023-06-141-0/+16
| | | | | There is a cross-reference here to code (`IptSortKey`) in another branch that I haven't made an MR for yet.
* tor-hsclient: impl HasRetryTime for FailedAttemptErrorIan Jackson2023-06-141-1/+24
|
* tor-hsclient: Conduct the INTRODUCE1 exchangeIan Jackson2023-06-131-0/+24
|
* tor-hsclient: Rename some errors for greater consistencyIan Jackson2023-06-131-10/+10
|
* tor-hsclient: Reorder timeout errors to be "less interesting"Ian Jackson2023-06-131-21/+21
| | | | | If something *other* than a timeout went wrong, then that is less expected so more interesting.
* tor-hsclient: (try to) receive the RENDEZVOUS2 messageIan Jackson2023-06-131-0/+16
|
* tor-hsclient: Add missing `#[source]` annotation for `Failure` errorIan Jackson2023-06-091-1/+1
| | | | Without this, the printed errors are very bland.
* tor-hsclient: Add a TODO for changing RendPtIdentityForErrorIan Jackson2023-06-091-0/+3
|
* tor-hsclient: Correct InvalidTarget errorIan Jackson2023-06-091-1/+1
| | | | | | | | | | | Remove TODO comment; instead, replace with a comment about future use for HS server side, inspired by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1228/diffs?commit_id=ecfd39507c4e8d52788f4599d6275cab3b4a2a5f#c0123bb2f6b9a9ca50fa45886b667580a7dc951e_79_82 Do not implment `tor_error::HasKind`; the true kind depends on where the bad information came from, which the calling code will understand. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1228/diffs?commit_id=d63ad3ab041460bf85defb99b31d6ebe075a0eb1#c0123bb2f6b9a9ca50fa45886b667580a7dc951e_101_110
* tor-hsclient: Implement rendezvous setup, and retry frameworkIan Jackson2023-06-091-0/+134
| | | | | | | | | | | | | | | | | | | | | This contains code to: * Iterate over introduction points * Make multiple attempts to connect * Apply timeouts to the various phases of each attempt * Establish a rendezvous point * Represent errors that occur during the above It provides places to add: * Implementation of the INTRODUCE1/INTRODUCE_ACK handshake * Reception of RENDEZVOUS2 and actual end-to-end circuit establishment * Recording of the outcome of connection attempts via particular IPTs * Using previous IPT outcome information for selecting IPTs to try * Tests of the new code (although more mocking will probably be needed) Much of this code works with a fixed type ClientCirc rather than going via the Mockable traits. That is wrong, and it will be fixed later.
* tor-hsclient: errors: Introduce IntroPtIndexIan Jackson2023-06-091-0/+12
| | | | | | We're going to want to report about rendezvous points in errors. We'll do this by printing the "number" of the intro point in the descriptor.
* tor-hsclient: errors: Introduce RendPtIdentityForErrorIan Jackson2023-06-091-0/+10
| | | | | We're going to want to report about rendezvous points in errors. We'll be using this. And we'll want to convert it from a Relay.
* tor-error: Introduce define_asref_dyn_std_error and use itIan Jackson2023-06-091-9/+2
| | | | | This factors out an ad-hoc AsRef impl. We're going to want to reuse this for another error type.
* hsclient: Rename import alias to reflect new name.Gabriela Moldovan2023-05-111-2/+2
| | | | | | A `NetdocErrorKind` is a `NEK` rather than a `PEK`. Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Rename parse_error_kind() to netdoc_error_kind().Gabriela Moldovan2023-05-111-1/+1
| | | | | | | `ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to rename this acccessor too. Signed-off-by: Gabriela Moldovan <[email protected]>