summaryrefslogtreecommitdiff
path: root/crates/tor-hsclient/src/connect.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-7/+9
| | | | | | | | | | | | 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]>
* 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-031-15/+31
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-hsclient: Add an allow to this incomplete codeIan Jackson2023-04-121-0/+1
| | | | Fixes CI warning.
* 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-111-7/+193
| | | | | | | | 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/
* hs desc: Record a Timebound<HsDesc> (but not really for now)Ian Jackson2023-04-111-6/+10
| | | | | | | | | We have a local alias of `HsDesc = String` which needs to be got rid of. But, right now the alternative would be to implement all the code for signature checking and decryption of an `HsDesc`, before we can make a test case for the downloader part.
* hs connect: Introduce ContextIan Jackson2023-04-111-13/+91
| | | | | This will be convenient as the common context for the descriptor download work, and also for testing.
* tor-hsconn: Rename ConnError (from HsClientConnError)Ian Jackson2023-03-301-3/+3
| | | | | The old name was unwieldy and other crates can just as well name it by the crate scope.
* tor-client: Pass a netdir for each requestIan Jackson2023-03-301-1/+6
| | | | | This will be more convenient inside tor-hsclient. In arti-client, this mirrors the way TorClient::get_or_launch_exit_circ works.
* Pass HS identity to hsclient connection functionIan Jackson2023-03-281-1/+4
| | | | Obviously it will need this!
* hsclient state: Rename rechecks (from attempts) and add clarifying docsIan Jackson2023-03-011-0/+3
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2882079
* hsclient: Use a generic to provide a mock for connect()Ian Jackson2023-03-011-1/+24
| | | | This will allow us to test state.rs.
* hsclient: Move dead code allows to specific locationsIan Jackson2023-03-011-0/+2
|
* hsclient: Implement connection attempt tracking state machineIan Jackson2023-03-011-0/+47
This compiles, but it cannot work yet. Nor can it conveniently be tested.