Commit Graph

6806 Commits

Author SHA1 Message Date
Ian Jackson c2952a5b20 tor-hsclient: Implement rendezvous setup, and retry framework
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.
2023-06-09 17:36:48 +01:00
Ian Jackson 4827ce8548 tor-error: Extend applicability of RemoteNetworkTimeout
We're going to use this for rendezvous completion timeout, which could
be due to basically anything.
2023-06-09 17:36:48 +01:00
Ian Jackson f194819b9e tor-hsclient: errors: Introduce IntroPtIndex
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.
2023-06-09 17:36:48 +01:00
Ian Jackson f40b21304d tor-hsclient: errors: Introduce RendPtIdentityForError
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.
2023-06-09 17:36:48 +01:00
Ian Jackson cfbd318132 tor-hsclient: Allow dead code for now
The dead code warnings are a nuisance while this file is half-written.
2023-06-09 17:36:48 +01:00
Ian Jackson 02b10a147c tor-hsclient: Mocks: Add get_or_launch_client_rend to mock pool
This has the wrong return type at the moment.
2023-06-09 17:36:48 +01:00
Ian Jackson 5bf917650a tor-hsclient: Mock trait: use actual HsCircPool in non-mock impl
The impl was in terms of itself.  Sadly, nothing warns about this bug.
2023-06-09 17:36:48 +01:00
Ian Jackson 9d22ce9f8a tor-hsclient: impl HasKind for InvalidTarget: ..DescriptorValidationFailed
This basically always means we couldn't cope with the descriptor.

We need to extend the description of OnionServiceDescriptorValidationFailed
2023-06-09 17:36:48 +01:00
Ian Jackson 33c90e5b72 tor-error: Introduce define_asref_dyn_std_error and use it
This factors out an ad-hoc AsRef impl.  We're going to want to reuse
this for another error type.
2023-06-09 17:36:48 +01:00
Ian Jackson f2f76f4f31 tor-hsclient: Have descriptor_ensure take only &mut data.desc
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.
2023-06-09 17:36:48 +01:00
Ian Jackson ccc9a35afe tor-hsclient: Move &mut Data out of Context, and pass &Context (fmt) 2023-06-09 17:36:48 +01:00
Ian Jackson 62f3981d27 tor-hsclient: Move &mut Data out of Context, and pass &Context
Now Context can be usefully shared, across different
threads/tasks/functions, so long as only one of them needs to modify
`Data`.
2023-06-09 17:36:48 +01:00
Ian Jackson 065ba51f93 tor-hsclient: export InvalidTarget
It's going to appear in our public errors.
2023-06-09 17:36:48 +01:00
Ian Jackson cbce8697b6 tor-hsclient: Add a TODO for InvalidTarget error 2023-06-09 17:36:48 +01:00
Alexander Færøy ab73cf9e8b Merge branch 'report-trait-doc-fix' into 'main'
Expand arti-client docs to include error reporting section

See merge request tpo/core/arti!1213
2023-06-09 13:12:48 +00:00
Alexander Færøy f48789f494 Merge branch 'warning' into 'main'
Fix a silly clippy warning

See merge request tpo/core/arti!1226
2023-06-09 12:25:04 +00:00
Ian Jackson c868446a55 Merge branch 'cookie' into 'main'
Implent Rng.gen() for RendCookie

See merge request tpo/core/arti!1227
2023-06-09 11:54:02 +00:00
Ian Jackson a50016b3da tor-hscrypto: implement Rng.gen() for RendCookie 2023-06-09 12:24:24 +01:00
Ian Jackson dc95c7874a tor-hscrypto: Break out REND_COOKIE_LEN
We need to reuse this.
2023-06-09 12:24:19 +01:00
trinity-1686a b7fd5a6778 change path to snowflake client 2023-06-08 20:19:59 +02:00
Ian Jackson e35cd4f115 Fix a silly clippy warning
Fixes
  nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets
2023-06-08 15:29:06 +01:00
Alexander Færøy 174332640d Merge branch 'hsclient-feature' into 'main'
hs: Fix a feature name in arti-client

See merge request tpo/core/arti!1222
2023-06-08 14:15:06 +00:00
Nick Mathewson f6691b90f4 Merge branch 'netdir' into 'main'
Expand docs for NetDirProvider

See merge request tpo/core/arti!1224
2023-06-08 11:59:08 +00:00
Ian Jackson de995c1164 Expand docs for NetDirProvider
Apropos a question that arose on IRC, to which I felt the answer
wasn't 100% unambiguous.

Also, reference the usual implementation (it can't be a link because
it's an upward reference).
2023-06-08 10:47:29 +01:00
trinity-1686a b3c8004f8d change link for more information on pts 2023-06-08 09:20:07 +02:00
Saksham Mittal 6e97b9df1f
Rephrase error handling to reporting 2023-06-08 10:26:52 +05:30
Saksham Mittal 3f7709f98d
Add error handling section in README 2023-06-08 10:26:52 +05:30
Saksham Mittal 724cab8a28
Add separate example with Report 2023-06-08 10:26:38 +05:30
trinity-1686a 73b0bc3561 remove forgoten debug line 2023-06-08 01:29:33 +02:00
trinity-1686a 9c3c7f4bc3 add anchor to amp-cache link 2023-06-08 00:28:58 +02:00
trinity-1686a 925ac7f9d7 complement general documentation on bridges and pt 2023-06-07 23:59:03 +02:00
trinity-1686a 4632d4ff44 move snowflake example to dedicated file and comment it more 2023-06-07 23:59:03 +02:00
trinity-1686a c528443bf4 add documentation for configuring snowflake pt 2023-06-07 23:59:03 +02:00
Nick Mathewson 999f914e03 rpc: make decl_object! responsible for writing impl Object {} blocks. 2023-06-07 14:37:04 -04:00
Nick Mathewson 924dbf7d8f Merge branch 'ipt_to_circtarget' into 'main'
Construct a CircTarget from an IntroPointDesc.

See merge request tpo/core/arti!1221
2023-06-07 12:35:26 +00:00
Nick Mathewson bdb96b4ac1 hs: Fix a feature name in arti-client
In arti-client it's called "onion-client", not "hs-client".
2023-06-07 08:21:22 -04:00
Nick Mathewson 618ed48cea hsclient: Create a CircTarget from an IntroPointDesc.
The main body of this function is written so that we can later use
it to create a CircTarget from an INTRODUCE2 message.
2023-06-07 07:55:45 -04:00
Alexander Færøy 2877140075 Merge branch 'access' into 'main'
hsdesc docs: Provide some accessors

See merge request tpo/core/arti!1220
2023-06-06 17:54:12 +00:00
Nick Mathewson 205b6d176c netdir, netdoc: Add accessors for protocol version status.
The consensus includes a listing for clients and for relays,
saying which protocol versions are _required_ for participation on
the network, and which versions are _recommended_.  We have been
parsing this, but not yet exposing it.

This commit adds accessors to expose it, since we'll need that in
order to create CircTargets for introduction points and rendezvous
points.
2023-06-06 09:06:01 -04:00
Nick Mathewson e7ebb31009 Merge branch 'remove_arrayref' into 'main'
Remove use of arrayref

Closes #872

See merge request tpo/core/arti!1214
2023-06-06 00:37:31 +00:00
Nick Mathewson 4b179de8ea Merge branch 'rpc_session_registry' into 'main'
Incomplete branch to implement an RPC session registry and link SOCKS streams to RPC

Closes #863

See merge request tpo/core/arti!1208
2023-06-06 00:33:39 +00:00
Nick Mathewson 362a1f8ac1 arti: Interpret socks request to mean "lookup an RPC session"
The actual decoding here is just a placeholder.  The important part
is that we can get either a (SessionId, StreamId) tuple out of the
request, or we treat it as part of an isolation token.

This commit has a few TODOs for additional things that we'll need
in order to build out our design.
2023-06-05 14:47:38 -04:00
Nick Mathewson 291c739003 arti: Move SOCKS code for building StreamPrefs and getting a TorClient. 2023-06-05 14:46:51 -04:00
Nick Mathewson 05e9bc199b arti: Add an alias in the SOCKS code for per-conn isolatino info.
This enables some small simplifications.
2023-06-05 14:46:51 -04:00
Nick Mathewson e102a1c943 RPC: Note a possible API change in RpcMgr::new. 2023-06-05 14:46:51 -04:00
Nick Mathewson 3a93c94f4b RPC: Make Session objects get a GlobalId. 2023-06-05 14:46:51 -04:00
Nick Mathewson 9f51bcb0be RPC: tell the `arti` SOCKS code about an RpcMgr object.
It will use this to find which TorClient to use when opening a
stream.
2023-06-05 14:46:51 -04:00
Nick Mathewson 27a5074635 RPC: Give out and accept GlobalIds for appropriate objects. 2023-06-05 14:46:51 -04:00
Nick Mathewson b7feb034a9 RPC: Let objects declare that they need a GlobalId. 2023-06-05 14:46:51 -04:00
Nick Mathewson 71e98b1a12 RPC: Implement a "global identifier" for non-session-bound IDs
These identifiers are actually only "global" with respect to a given
`RpcMgr`, but they should not be forgeable or reusable across RpcMgr
objects.  We're going to use them so that we have a kind of identifier
for `TorClient`s that we can expose to SOCKS.
2023-06-05 14:46:51 -04:00