aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hsclient/src
Commit message (Collapse)AuthorAgeFilesLines
...
* tor-hsclient: Add a TODO for changing RendPtIdentityForErrorIan Jackson2023-06-091-0/+3
|
* tor-hsclient: Improve description of `Context`Ian Jackson2023-06-091-3/+7
| | | | | Be more specific about precisely what it's the context for, and its lifetime.
* tor-hsclient: Correct InvalidTarget errorIan Jackson2023-06-092-10/+5
| | | | | | | | | | | 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: mocks: Fix new code to use mockable ClientCircIan Jackson2023-06-091-18/+36
|
* tor-hsclient: mocks: Make MockableClientCirc be DebugIan Jackson2023-06-091-1/+2
|
* tor-hsclient: mocks: Provide send_control_messageIan Jackson2023-06-091-0/+21
| | | | | | | We were able to get as far as we have, merely because all the new code uses just Arc<ClientCirc> rather than the mockable version. We want to change that, so we need to mock this function too.
* tor-hsclient: Call the mock with the result circuitIan Jackson2023-06-091-0/+5
|
* tor-hsclient: Define representation of intro point experience dataIan Jackson2023-06-091-3/+44
| | | | | This is the data structure for recording IPT outcomes and, later, selecting a good IPT to try for a new connection.
* tor-hsclient: Implement rendezvous setup, and retry frameworkIan Jackson2023-06-093-6/+475
| | | | | | | | | | | | | | | | | | | | | 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-092-1/+13
| | | | | | 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-092-0/+11
| | | | | 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-hsclient: Allow dead code for nowIan Jackson2023-06-091-0/+2
| | | | The dead code warnings are a nuisance while this file is half-written.
* tor-hsclient: Mocks: Add get_or_launch_client_rend to mock poolIan Jackson2023-06-091-0/+19
| | | | This has the wrong return type at the moment.
* tor-hsclient: Mock trait: use actual HsCircPool in non-mock implIan Jackson2023-06-091-5/+6
| | | | The impl was in terms of itself. Sadly, nothing warns about this bug.
* tor-hsclient: impl HasKind for InvalidTarget: ..DescriptorValidationFailedIan Jackson2023-06-091-1/+7
| | | | | | This basically always means we couldn't cope with the descriptor. We need to extend the description of OnionServiceDescriptorValidationFailed
* 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.
* tor-hsclient: Have descriptor_ensure take only &mut data.descIan Jackson2023-06-091-6/+8
| | | | | | It returns a borrow (so whatever is passed remains borrowed) and the next phase is going to need to perhaps mutate other parts of data, so we must pass only what is needed.
* tor-hsclient: Move &mut Data out of Context, and pass &Context (fmt)Ian Jackson2023-06-091-9/+1
|
* tor-hsclient: Move &mut Data out of Context, and pass &ContextIan Jackson2023-06-091-19/+12
| | | | | | Now Context can be usefully shared, across different threads/tasks/functions, so long as only one of them needs to modify `Data`.
* tor-hsclient: export InvalidTargetIan Jackson2023-06-091-0/+1
| | | | It's going to appear in our public errors.
* tor-hsclient: Add a TODO for InvalidTarget errorIan Jackson2023-06-091-0/+4
|
* hsclient: Create a CircTarget from an IntroPointDesc.Nick Mathewson2023-06-072-0/+101
| | | | | The main body of this function is written so that we can later use it to create a CircTarget from an INTRODUCE2 message.
* tor-hsclient: Mockable: Do concrete calls with UFCSIan Jackson2023-05-231-2/+2
| | | | | | | | | | | | Method dispatch rules mean that if the receiver type of the actual function changes, `self.call()` can turn into a purely-recursive call which overflows the stack. Async Rust doesn't have the usual warning for this situation :-(. UFCS is clumsier but doesn't have that problem because it involves much less magical dispatch. Instead of generating a recursive call which overflows the stack, it fails to compile.
* tor-hsclient: Fix MockableClientCirc for ClientCirc changesIan Jackson2023-05-231-3/+3
| | | | | | ClientCirc::begin_dir_stream now takes Arc<Self>. Method resolution rules mean that this code would just recurse, leading to a stack overflow.
* Fix a docs reference to refer to HsClientIntroAuthKeypairIan Jackson2023-05-221-1/+1
| | | | | | | | Fixes warning from cargo -o doc --document-private-items --all-features --workspace This was evidentlhy overlooked during recent replacement of unescorted private keys in the code.
* netdoc, hsclient: Update remaining ed25519::SecretKey usersNick Mathewson2023-05-182-5/+7
| | | | | | Fortunately, these are all in experimental code. Closes #798
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-163-16/+18
| | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* hsclient: descriptor_ensure no longer wraps the descriptor in TimerangeBound.Gabriela Moldovan2023-05-131-2/+5
| | | | | | | `descriptor_fetch_attempt` now returns a `TimerangeBound<HsDesc>` (and so does `parse_descript_validate`). Signed-off-by: Gabriela Moldovan <[email protected]>
* hsclient: Compute HsDesc validity time from the TimerangeBounds of its layers.Gabriela Moldovan2023-05-131-25/+13
| | | | | | | This makes `descriptor_ensure` refetch the descriptor if either of its layers (inner or outer) expires. Signed-off-by: Gabriela Moldovan <[email protected]>
* hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.Gabriela Moldovan2023-05-131-17/+33
| | | | | | | This makes `descriptor_ensure` refetch the descriptor if it has been cached for longer than `descriptor-lifetime` minutes. Signed-off-by: Gabriela Moldovan <[email protected]>
* 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]>
* netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.Gabriela Moldovan2023-05-101-1/+1
| | | | | | | | | | | `ParseErrorSource` was originally meant to represent a parsing error, this enum has since gained some variants that aren't really parsing related (`Signature`, `CertSignature`, `UntimelyDescriptor`). Since this error type is now used for general-purpose netdoc errors, let's rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`. Signed-off-by: Gabriela Moldovan <[email protected]>
* fix a couple clippy lintstrinity-1686a2023-05-081-1/+1
|
* tor-netdir: Shuffle the list of HS dirs used for downloading descriptors.Gabriela Moldovan2023-05-041-5/+25
| | | | | | | | We'll probably need the hsdir list to be shuffled deterministically for testing purposes (this might be desirable, for example, when we write a test for HS descriptor download retries). Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-netdir: Update tests to parse the descriptor, make test consensus ↵Gabriela Moldovan2023-05-031-9/+59
| | | | | | lifetime configurable. Signed-off-by: Gabriela Moldovan <[email protected]>
* hsclient: Use a real HsDesc instead of an unparsed string.Gabriela Moldovan2023-05-033-18/+43
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-hsclient: Add an allow to this incomplete codeIan Jackson2023-04-121-0/+1
| | | | Fixes CI warning.
* Apply ProtocolViolation renaming to hs connector codeIan Jackson2023-04-121-2/+2
| | | | | | | | | | | !1121 renamed *ProtocolFailed to *ProtocolViolation. !1118 introduced a new reference to a *ProtocolFailed I rebased !1118 onto main and enabled automerge. That tested the tip of !1118. I assume a similar thing happened to !1121. The possibility of such regressions is a property of our workflow. It's rather surprising it doesn't happen more often.
* Use bool::then_some() as appropriateNick Mathewson2023-04-111-1/+1
| | | | | | Now that we require a version of Rust that allows `b.then_some(v)`, clippy complains about our use of `b.then(|| v)`.
* hs connect: Improve a todo and refer to #813Ian Jackson2023-04-111-2/+1
|
* hs connect: Add TODOs re improving testsIan Jackson2023-04-111-0/+3
| | | | | Aa per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1118#note_2894467
* hs connect: Add TODO re multiple parallel hsdir requestsIan Jackson2023-04-111-0/+2
|
* hs connect: Improve docs for descriptor_ensureIan Jackson2023-04-111-1/+7
|
* hs connect: Clarify clientness of ContextIan Jackson2023-04-111-1/+1
|
* hs connect tests: check that we asked exactly one relayIan Jackson2023-04-111-6/+6
|
* hs connect tests: derive Default for MocksGlobal, and use itIan Jackson2023-04-111-2/+2
|
* hs connect: Test descriptor downloadIan Jackson2023-04-111-0/+120
|
* hs connect: Do circuitry etc. via mocks traitIan Jackson2023-04-111-7/+59
| | | | | This doesn't change the text of the functional code, but now the methods are indirected via the Mock* traits.
* hs dirs: Initial cut at descriptor downloadingIan Jackson2023-04-113-9/+307
| | | | | | | | There are many TODOs here. Some are questions; some are straightforward and can be done in followups. With this code, I am able to reach the eprintln! and todo! with curl --socks5-hostname localhost:9150 https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/