Ian Jackson
2f838dce15
tor-hsclient: tuning parameters: TODO about getting from the netdir
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1228#note_2910286
Not thinking about this right now, but it seems like a reasonable
suggestion.
2023-06-09 17:36:48 +01:00
Ian Jackson
00d5978999
tor-hsclient: Add vacuous doc comments
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1228#note_2910284
2023-06-09 17:36:48 +01:00
Ian Jackson
b2faf02170
tor-hsclient: Add a TODO for changing RendPtIdentityForError
2023-06-09 17:36:48 +01:00
Ian Jackson
bcbe66f636
tor-hsclient: Improve description of `Context`
...
Be more specific about precisely what it's the context for, and its
lifetime.
2023-06-09 17:36:48 +01:00
Ian Jackson
4e2321086f
tor-hsclient: Correct InvalidTarget error
...
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
2023-06-09 17:36:48 +01:00
Ian Jackson
742462deae
tor-hsclient: mocks: Fix new code to use mockable ClientCirc
2023-06-09 17:36:48 +01:00
Ian Jackson
6c377cdeec
tor-hsclient: mocks: Make MockableClientCirc be Debug
2023-06-09 17:36:48 +01:00
Ian Jackson
cead8e2716
tor-hsclient: mocks: Provide send_control_message
...
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.
2023-06-09 17:36:48 +01:00
Ian Jackson
8e5814c683
tor-hsclient: Call the mock with the result circuit
2023-06-09 17:36:48 +01:00
Ian Jackson
90a48f5b52
tor-hsclient: Define representation of intro point experience data
...
This is the data structure for recording IPT outcomes and, later,
selecting a good IPT to try for a new connection.
2023-06-09 17:36:48 +01:00
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
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
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
Nick Mathewson
daf5ecc153
Bump crate versions in preparation for v1.1.5 release.
...
Generated with the following commands:
```
cargo set-version --bump minor -p tor-cell
cargo set-version --bump minor -p tor-linkspec
cargo set-version --bump minor -p tor-proto
cargo set-version --bump minor -p tor-netdoc
cargo set-version --bump minor -p tor-circmgr
cargo set-version --bump patch -p tor-cert
cargo set-version --bump patch -p tor-basic-utils
cargo set-version --bump patch -p tor-rpcbase
cargo set-version --bump patch -p tor-llcrypto
cargo set-version --bump patch -p tor-hscrypto
cargo set-version --bump patch -p tor-checkable
cargo set-version --bump patch -p tor-async-utils
cargo set-version --bump patch -p caret
cargo set-version --bump patch -p fs-mistrust
cargo set-version --bump patch -p safelog
cargo set-version --bump patch -p retry-error
cargo set-version --bump patch -p tor-error
cargo set-version --bump patch -p tor-config
cargo set-version --bump patch -p tor-events
cargo set-version --bump patch -p tor-units
cargo set-version --bump patch -p tor-rtcompat
cargo set-version --bump patch -p tor-rtmock
cargo set-version --bump patch -p tor-protover
cargo set-version --bump patch -p tor-bytes
cargo set-version --bump patch -p tor-socksproto
cargo set-version --bump patch -p tor-consdiff
cargo set-version --bump patch -p tor-netdir
cargo set-version --bump patch -p tor-congestion
cargo set-version --bump patch -p tor-persist
cargo set-version --bump patch -p tor-chanmgr
cargo set-version --bump patch -p tor-ptmgr
cargo set-version --bump patch -p tor-guardmgr
cargo set-version --bump patch -p tor-dirclient
cargo set-version --bump patch -p tor-dirmgr
cargo set-version --bump patch -p tor-hsclient
cargo set-version --bump patch -p tor-hsservice
cargo set-version --bump patch -p arti-client
cargo set-version --bump patch -p arti-rpcserver
cargo set-version --bump patch -p arti-config
cargo set-version --bump patch -p arti-hyper
cargo set-version --bump patch -p arti
cargo set-version --bump patch -p arti-bench
cargo set-version --bump patch -p arti-testing
```
2023-06-01 10:03:05 -04:00
Ian Jackson
5ba7f31c1d
tor-hsclient: Mockable: Do concrete calls with UFCS
...
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.
2023-05-23 12:47:33 +01:00
Ian Jackson
79b9a26df0
tor-hsclient: Fix MockableClientCirc for ClientCirc changes
...
ClientCirc::begin_dir_stream now takes Arc<Self>. Method resolution
rules mean that this code would just recurse, leading to a stack
overflow.
2023-05-23 12:47:33 +01:00
Ian Jackson
1fc1c269c3
Fix a docs reference to refer to HsClientIntroAuthKeypair
...
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.
2023-05-22 14:30:16 +01:00
Nick Mathewson
82801d9963
netdoc, hsclient: Update remaining ed25519::SecretKey users
...
Fortunately, these are all in experimental code.
Closes #798
2023-05-18 14:18:53 -04:00
Nick Mathewson
ee390c423e
Refactor ClientCirc APIs to use Arc<ClientCirc>.
...
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.
2023-05-16 09:02:09 -04:00
Nick Mathewson
e2e125fef7
Reformat Cargo.toml files.
2023-05-15 09:09:43 -04:00
Nick Mathewson
7a5373c110
Run fixup-features --no-annotate for initial Cargo.toml fixes.
...
This does the following:
- Gives every crate a `full`.
- Cause every `full` to depend on `full` from the lower-level
crates.
- Makes every feature listed _directly_ in `experimental` depend
on `__is_experimental`.
2023-05-15 09:07:21 -04:00
Gabriela Moldovan
6992427596
hsclient: descriptor_ensure no longer wraps the descriptor in TimerangeBound.
...
`descriptor_fetch_attempt` now returns a `TimerangeBound<HsDesc>` (and
so does `parse_descript_validate`).
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:37 +01:00
Gabriela Moldovan
92e0b6a029
hsclient: Compute HsDesc validity time from the TimerangeBounds of its layers.
...
This makes `descriptor_ensure` refetch the descriptor if either of its
layers (inner or outer) expires.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:20 +01:00
Gabriela Moldovan
88ea5032f4
hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.
...
This makes `descriptor_ensure` refetch the descriptor if it has been
cached for longer than `descriptor-lifetime` minutes.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-13 12:48:13 +01:00
Gabriela Moldovan
7dfa25db35
hsclient: Rename import alias to reflect new name.
...
A `NetdocErrorKind` is a `NEK` rather than a `PEK`.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-11 18:46:04 +01:00
Gabriela Moldovan
0422893373
netdoc: Rename parse_error_kind() to netdoc_error_kind().
...
`ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to
rename this acccessor too.
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-11 18:39:40 +01:00
Gabriela Moldovan
099b2315b0
netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.
...
`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 <gabi@torproject.org>
2023-05-10 15:52:28 +01:00
trinity-1686a
fe68f0a119
fix a couple clippy lints
2023-05-08 18:01:28 +02:00
Gabriela Moldovan
6b9e37e07c
tor-netdir: Shuffle the list of HS dirs used for downloading descriptors.
...
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 <gabi@torproject.org>
2023-05-04 17:53:58 +01:00
Gabriela Moldovan
30983c764f
tor-netdir: Update tests to parse the descriptor, make test consensus lifetime configurable.
...
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-03 17:25:25 +01:00
Gabriela Moldovan
c6fccbbb01
hsclient: Use a real HsDesc instead of an unparsed string.
...
Signed-off-by: Gabriela Moldovan <gabi@torproject.org>
2023-05-03 17:25:21 +01:00
Nick Mathewson
e845a553f3
Upgrade tracing to 0.1.36.
...
This is the first version to impl Value for String.
With luck, this will get minimal_versions CI passing.
2023-05-03 11:09:21 -04:00
Nick Mathewson
1904cfc8b9
Increment crate versions.
...
Because of the errorkind bumps, we're calling this a breaking change
in everything lower-level than `arti`.
Generated with:
```
cargo set-version -p tor-basic-utils --bump minor
cargo set-version -p tor-async-utils --bump minor
cargo set-version -p caret --bump minor
cargo set-version -p fs-mistrust --bump minor
cargo set-version -p safelog --bump minor
cargo set-version -p retry-error --bump minor
cargo set-version -p tor-error --bump minor
cargo set-version -p tor-config --bump minor
cargo set-version -p tor-events --bump minor
cargo set-version -p tor-units --bump minor
cargo set-version -p tor-rtcompat --bump minor
cargo set-version -p tor-rtmock --bump minor
cargo set-version -p tor-rpcbase --bump minor
cargo set-version -p tor-llcrypto --bump minor
cargo set-version -p tor-protover --bump minor
cargo set-version -p tor-bytes --bump minor
cargo set-version -p tor-hscrypto --bump minor
cargo set-version -p tor-socksproto --bump minor
cargo set-version -p tor-checkable --bump minor
cargo set-version -p tor-cert --bump minor
cargo set-version -p tor-linkspec --bump minor
cargo set-version -p tor-cell --bump minor
cargo set-version -p tor-proto --bump minor
cargo set-version -p tor-netdoc --bump minor
cargo set-version -p tor-consdiff --bump minor
cargo set-version -p tor-netdir --bump minor
cargo set-version -p tor-congestion --bump minor
cargo set-version -p tor-persist --bump minor
cargo set-version -p tor-chanmgr --bump minor
cargo set-version -p tor-ptmgr --bump minor
cargo set-version -p tor-guardmgr --bump minor
cargo set-version -p tor-circmgr --bump minor
cargo set-version -p tor-dirclient --bump minor
cargo set-version -p tor-dirmgr --bump minor
cargo set-version -p tor-hsclient --bump minor
cargo set-version -p tor-hsservice --bump minor
cargo set-version -p arti-client --bump minor
cargo set-version -p arti-rpcserver --bump minor
cargo set-version -p arti-config --bump minor
cargo set-version -p arti-hyper --bump minor
cargo set-version -p arti --bump patch
cargo set-version -p arti-bench --bump patch
cargo set-version -p arti-testing --bump patch
```
2023-05-03 08:31:11 -04:00
Ian Jackson
3caa8e61e9
tor-hsclient: Add an allow to this incomplete code
...
Fixes CI warning.
2023-04-12 11:50:27 +01:00
Ian Jackson
d566502fc3
Apply ProtocolViolation renaming to hs connector code
...
!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.
2023-04-12 10:40:29 +01:00
Nick Mathewson
e26445b1b0
Use bool::then_some() as appropriate
...
Now that we require a version of Rust that allows
`b.then_some(v)`, clippy complains about our use of
`b.then(|| v)`.
2023-04-11 15:32:32 -04:00
Nick Mathewson
104d64589d
Increment MSRV to 1.65 in every crate.
2023-04-11 15:31:12 -04:00
Ian Jackson
592252ae0a
hs connect: Improve a todo and refer to #813
2023-04-11 19:14:01 +01:00
Ian Jackson
26d3bf67e9
hs connect: Add TODOs re improving tests
...
Aa per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1118#note_2894467
2023-04-11 19:14:01 +01:00
Ian Jackson
db457de99b
hs connect: Add TODO re multiple parallel hsdir requests
2023-04-11 19:14:01 +01:00
Ian Jackson
7198afa153
hs connect: Improve docs for descriptor_ensure
2023-04-11 19:14:01 +01:00
Ian Jackson
b78240131f
hs connect: Clarify clientness of Context
2023-04-11 19:14:01 +01:00
Ian Jackson
54bec0bf8d
hs connect tests: check that we asked exactly one relay
2023-04-11 19:14:01 +01:00
Ian Jackson
2ac87a6690
hs connect tests: derive Default for MocksGlobal, and use it
2023-04-11 19:14:01 +01:00
Ian Jackson
f5a5743468
hs connect: Test descriptor download
2023-04-11 19:14:01 +01:00
Ian Jackson
be98cb890d
hs connect: Do circuitry etc. via mocks trait
...
This doesn't change the text of the functional code, but now the
methods are indirected via the Mock* traits.
2023-04-11 19:14:01 +01:00
Ian Jackson
e6b8752d98
hs dirs: Initial cut at descriptor downloading
...
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/
2023-04-11 19:14:01 +01:00
Ian Jackson
99bc97118f
hs desc: Record a Timebound<HsDesc> (but not really for now)
...
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.
2023-04-11 19:14:01 +01:00
Ian Jackson
bb5b2be5f1
hs connect: Introduce Context
...
This will be convenient as the common context for the descriptor
download work, and also for testing.
2023-04-11 19:14:01 +01:00
Nick Mathewson
d3a727a5a1
Remove "publish = false" from tor-hsclient.
...
It is now a (conditional, experimental) dependency of arti-client.
2023-03-31 09:14:35 -04:00
Nick Mathewson
9ef115a7fb
Patchlevel bumps for crates whose dependencies just changed.
...
These crates had no changes until just a moment ago. But since
we updated the versions on some of their dependents, they have now
changed themselves. Thus they get patchlevel bumps.
```
tor-rtmock
tor-protover
tor-socksproto
tor-consdiff
tor-chanmgr
tor-dirclient
tor-hsservice
```
2023-03-31 08:30:14 -04:00
Nick Mathewson
e208fb15ad
Bump crate versions that have breaking changes
...
These crates have had breaking changes. They are pre-1.0, so they get
a minor bump.
```
tor-basic-utils
tor-config
```
2023-03-31 08:28:06 -04:00
Nick Mathewson
a81ab391ae
Bump patchlevel on crates with non-breaking changes
...
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.
Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes. (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)
These are unstable crates with breaking changes:
```
tor-hscrypto
tor-hsclient
```
These have new or extended APIs:
```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```
These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```
These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson
f245fc12bb
tor-hsclient: Fix a doc link.
2023-03-30 15:12:57 -04:00
Ian Jackson
23c7bd9174
Run rustfmt
...
Apply this churn, which I deferred for ease of review.
2023-03-30 15:58:47 +01:00
Ian Jackson
3ed9dca842
tor-hsconn: Rename ConnError (from HsClientConnError)
...
The old name was unwieldy and other crates can just as well name it by
the crate scope.
2023-03-30 15:49:07 +01:00
Ian Jackson
926abf3ade
tor-client: Pass a netdir for each request
...
This will be more convenient inside tor-hsclient. In arti-client,
this mirrors the way TorClient::get_or_launch_exit_circ works.
2023-03-30 15:49:07 +01:00
Ian Jackson
5ff24c9f84
Pass HS identity to hsclient connection function
...
Obviously it will need this!
2023-03-28 15:49:45 +01:00
Ian Jackson
9b6be7eaa7
Pass HsCircPool to hsclient connect function, not CircMgr
...
We separated this out in the circmgr API. This is what the HS client
needs. It doesn't want to participate in the general circuit pool.
2023-03-28 15:49:45 +01:00
Ian Jackson
93809cc594
tor-proto: Split off send-control-msg feature
2023-03-23 11:50:18 +00:00
Ian Jackson
c36177733d
tor-hsclient: Have the public API take StreamIsolation
2023-03-23 11:50:14 +00:00
Ian Jackson
adc180294a
tor-hsclient: impl HasKind for errors
2023-03-23 11:50:14 +00:00
Ian Jackson
2edd71a4f0
tor-hsclient: Swap errors so Bug comes last
...
This seems more consistent with the way it's done elsewhere.
2023-03-23 11:50:14 +00:00
Ian Jackson
a2f4260666
tor-hsclient: Document clone-nature of HsClientConnector
2023-03-23 11:50:14 +00:00
Dimitris Apostolou
dedae15446
Fix typos
2023-03-03 13:00:33 +02:00
Ian Jackson
fd0d50a330
hsclient: Discuss HsClientConnector multiplicity/reuse
...
And delete the associated TODO.
2023-03-01 18:12:29 +00:00
Ian Jackson
1fc93b4215
hsclient: Remove TODOs about circular references
...
These Arcs are all "downward", referencing items from layers lower in
the stack. So they don't cause cycles.
There was going to be a cycle involving the `OnionConnector` upcall
trait, but we have just abolished that.
2023-03-01 18:12:29 +00:00
Ian Jackson
bf2c0d6ff8
hsclient: Abolish knowledge of HS circuits in circmgr
...
Abolish CircMgr::get_or_launch_onion_client and everything to support
it. We have decided that `.onion` diversion ccan't/shouldn't occur in
tor-circmgr. Probably, it should occur much higher up - arti-client
maybe - since it will sometimes need ambient authority (KS_hsc_*).
Now all knowledge of HS connections is in tor-hsclient. This
gets rid of a layering inversion and the trait needed for tor-circmgr
to do the upcall to tor-hsclient.
2023-03-01 18:12:29 +00:00
Ian Jackson
7230f89b32
hsclient isol_map: Use 1:1 notation in diagram to show correspondence
2023-03-01 16:39:03 +00:00
Ian Jackson
fea656d7ee
hsclient isol_map: Document invariant, fix comment, terminology
...
Use the occupied/vacant terminology that the slotmap docs use.
2023-03-01 16:39:03 +00:00
Ian Jackson
d4d02fa4e9
hsclient state: Rename rechecks (from attempts) and add clarifying docs
...
Prompted by
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2882079
2023-03-01 16:39:03 +00:00
Ian Jackson
649d0e0d25
hsclient keys: Be more explicit about HsClientSecretKeys nullable
...
It can contain no keys; state this more prominently, and explain what
it represents. Also fix a few typos etc.
2023-03-01 16:39:03 +00:00
Ian Jackson
b2139731ac
hsclient state: Implement and test MultikeyIsolatedMap::retain
2023-03-01 16:39:03 +00:00
Ian Jackson
b6fc44aa71
hsclient state: Split off MultikeyIsolatedMap
2023-03-01 16:39:03 +00:00
Ian Jackson
90a7e82fcd
hsclient state: Move all the data fields into the table
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881576
This is a singificant simplification, in fact.
2023-03-01 16:39:03 +00:00
Ian Jackson
08ede75905
hsclient: Clarify period task handle TODO
2023-03-01 16:39:03 +00:00
Ian Jackson
e6aa199da6
hsclient: Document sharing rules
...
Text largely from
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881638
2023-03-01 16:39:03 +00:00
Ian Jackson
cfa33e53d5
hsclient state: rustfmt
...
Autogenerated with rustfmt; no code changes.
This tidies up the bizarre formatting.
2023-03-01 16:39:03 +00:00
Ian Jackson
597601e4a3
hsclient state: Lots more doc comments about barriers, structure, etc.
2023-03-01 16:39:03 +00:00
Ian Jackson
0b39a180b0
hsclient state: Break `obtain` out into a fn
...
This is getting rather confusing; simply reformtting it won't do, I
think. Also there would be much rightward drift.
So move the meat out into the new function.
(And introduce a convenience alias for its captures.)
Docs and reformatting will follow in a moment.
2023-03-01 16:39:03 +00:00
Ian Jackson
a93a7b4bab
hsclient state: Demonstrate that our future is now Send
2023-03-01 16:39:03 +00:00
Ian Jackson
1f03e118ef
hsclient state: Restructure using a scope to drop the mutex guard
...
Explicit drops don't work. Instead, introduce a scope.
We need two scopes, actually: one where we do the initial table
wrangling, and one for the retries after relock.
So we must put the meat in a closure so we can reuse it.
And we must return the flow control as an enum. Bah, etc.
Avoid reformatting this for the moment. This makes the delta legible...
2023-03-01 16:39:03 +00:00
Ian Jackson
d1863c3178
hsclient state: Break out ServiceState::blank
...
We're going to have another function which will want this.
Leave a convenience closure to capture the runtime.
2023-03-01 16:27:19 +00:00
Ian Jackson
4f5f378516
hsclient state: Move error inspection before guard re-lock.
...
This is still correct from a lock hierarchy pov. It moves the guard
relock to the end, which is going to be necessary since it is going to
have to move right outside the loop.
2023-03-01 16:27:19 +00:00
Ian Jackson
1e905763e3
hsclient keys: Add a todo to remove spurious Option
2023-03-01 16:27:19 +00:00
Ian Jackson
7134ddd454
hsclient keys: Compare all empty sets of keys as equal
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1034#note_2881575
2023-03-01 16:27:19 +00:00
Ian Jackson
5da60ff72d
hsclient keys: Fix non-equal keys test to provide a (dummy) key (fmt)
2023-03-01 16:27:19 +00:00
Ian Jackson
ff55d7b133
hsclient keys: Fix non-equal keys test to provide a (dummy) key
...
We're about to fix the comparison to treat all empty key sets as
equal.
2023-03-01 16:27:19 +00:00
Ian Jackson
e3e66793c4
hsclient keys: Provide :none() and Default and .is_empty()
2023-03-01 16:27:19 +00:00
Ian Jackson
896ea10b7f
hsclient keys: Fix a missing full stop
2023-03-01 16:27:19 +00:00
Ian Jackson
ab163cf81a
hsclient state: Test most important code paths
2023-03-01 16:27:19 +00:00
Ian Jackson
8e088d72d5
hsclient: Provide some missing debug impls and trace messages
2023-03-01 16:27:19 +00:00
Ian Jackson
288b7b6ad1
Apply rustfmt
2023-03-01 16:27:19 +00:00
Ian Jackson
d384c3b475
hsclient state: Provide one test
2023-03-01 16:27:17 +00:00
Ian Jackson
d7602c5be4
hsclient: Use a generic to provide a mock for connect()
...
This will allow us to test state.rs.
2023-03-01 16:20:16 +00:00
Ian Jackson
9ebe22756e
hsclient: Apply standard lint block
2023-03-01 16:20:16 +00:00
Ian Jackson
ff1be04012
hsclient: Move dead code allows to specific locations
2023-03-01 16:20:16 +00:00
Ian Jackson
b430c65ddb
hsclient: Add vacuous comments as demanded by clippy
2023-03-01 16:20:16 +00:00
Ian Jackson
bac3c4a9a4
hsclient state: Bind a variable to stop rustfmt doing a terrible thing
2023-03-01 16:20:16 +00:00
Ian Jackson
76a160d5a7
hsclient: Provide a constructor for HsClientConnector
2023-03-01 16:20:16 +00:00
Ian Jackson
e8b5195281
hsclient: Implement connection attempt tracking state machine
...
This compiles, but it cannot work yet. Nor can it conveniently be tested.
2023-03-01 16:20:16 +00:00
Ian Jackson
4ec9ec92bc
HS secret keys: Move aggregate/config to tor-hsclient
...
Provide a more cookied "secret keys for use to connecting to a
particular HS" type, with a builder.
This wants to use config stuff, so oughtn't to be in tor-*crypto.
The individual types remain there.
2023-03-01 16:19:31 +00:00
Ian Jackson
891782122d
hsclient API: Remove notion of ambient keys fromk this layer
2023-03-01 16:18:09 +00:00
Ian Jackson
a45acb3905
HS API: Remove HS client keys from circmgr API
...
*If* we're going to retain any HS knowledge in circmgr, it definitely
doesn't need to know about per-operation client secrets.
(Maybe there might be ambient secrets, used for .onion diversion, but
they don't need to be in this API.)
2023-03-01 16:18:09 +00:00
Ian Jackson
feeb38c750
HS planning: Discuss whether to remove all HS code from circmgr
2023-03-01 16:18:09 +00:00
Nick Mathewson
f41449d0bd
Patchlevel bumps for remaining changed crates.
...
These crates have had small code changes, but no API additions:
tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion
These crates have had API extensions:
fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson
4479d52a88
Bump patch-versions for breaking changes in tor-hs{crypto,client}
...
These are API breaks, but the crates themselves are currently
100% experimental, so there's no need to bump the minor versions
according to our semver rules.
2023-02-28 07:06:15 -05:00
Nick Mathewson
3e257a7cb5
Bump minor versions for significant breaking changes.
...
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Ian Jackson
f63c7c48af
Rename onion-* cargo features to hs-* in tor-* crates
...
Fixes #756
2023-02-28 11:10:17 +00:00
Nick Mathewson
99ec1c9818
tor-hscrypto: Rename key types to correspond to new spec names.
2023-02-08 12:27:36 -05:00
Nick Mathewson
7c1b6a5a81
Bump the patch version of every crate that had API additions
...
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson
66f594a4b6
Bump the patch-level version of crates with _minor_ changes.
...
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Nick Mathewson
5b4ffc5e48
Note a needed isolation API.
2023-01-24 12:32:21 -05:00
Nick Mathewson
32ae6dfa09
Add a new stub hsclient module to connect to onion services.
2023-01-24 12:32:21 -05:00