Commit Graph

7200 Commits

Author SHA1 Message Date
Ian Jackson aa8bf740db Merge branch 'hs' into 'main'
Store our IPT experiences and try to try good IPTs first

See merge request tpo/core/arti!1247
2023-06-15 16:18:06 +00:00
Nick Mathewson 9e8ad5415e rpc: Give the session-creation function an argument.
This will later let us tell the session-creation function
how the authentication occurred, which will let it decide
what privileges to provide.
2023-06-15 11:50:12 -04:00
Nick Mathewson 2d28402fb7 rpc: revise session initialization a lot.
Formerly, every time we wanted to launch a new connection, we had
to give the RpcMgr a TorClient.  The connection would hold that
TorClient until a session was authenticated, and then would wrap
it in a Session and put it in the object map.

Now, the RpcMgr holds a Box<dyn Fn()...> that knows how to
create Sessions.  When a connection is authenticated, it
asks the Mgr to make it a new session.  This lets us make it
clearer that the TorClient simply can't be given out until the
connection is authenticated.  Later, it will let us create
more types of Session objects under more complicated rules.
2023-06-15 11:44:14 -04:00
Ian Jackson a1934e7102 tor-hsclient: Make Untried a {}-less unit
Suggested here
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1247#note_2912642

It's unlikely this will grow any content, so fine.
2023-06-15 16:43:45 +01:00
gabi-250 7e601fba01 tor-hsclient: Insert a blank line 2023-06-15 16:43:45 +01:00
gabi-250 d99434d06b tor-hsclient: Docs improvements. 2023-06-15 16:43:45 +01:00
Ian Jackson 856269f7a7 tor-hsclient: Remove two done TODOs 2023-06-15 16:43:45 +01:00
Ian Jackson 731cc9ed44 tor-hsclient: provide intro_index accessor for FailedAttemptError (xref)
Add a cross-reference to docs arising from MR comments in !1246.
2023-06-15 16:43:45 +01:00
Ian Jackson 2dfa00f379 tor-hsclient: Actually store our IPT experiences 2023-06-15 16:43:45 +01:00
Ian Jackson f5a895b33f tor-hsclient: intro_rend_connect: bind `outcome`
This will be used in a moment.
2023-06-15 16:43:45 +01:00
Ian Jackson 4f4f753b6a tor-hsclient: Actually choose which intro points to use
Right now this just always chooses randomly because nothing stores
anything in the HashMap.
2023-06-15 16:43:45 +01:00
Ian Jackson 65d7d499d7 tor-hsclient: Introduce RelayIdForExperience
Wrap this up in a newtype so we don't accidentally use it for anything
else.  Provide two constructors, one for storing and one for lookups.
2023-06-15 16:43:45 +01:00
Ian Jackson 397c4fb01f tor-hsclient: Add random sort key to UsableIpt 2023-06-15 16:43:45 +01:00
Ian Jackson 279afeefc2 tor-hsclient: provide intro_index accessor for FailedAttemptError 2023-06-15 16:43:45 +01:00
Ian Jackson dac7a45ea8 tor-error: Introduce `LooseCmpRetryTime`
Having a newtype for this kind of thing is considerably more
convenient.  I'm going to use this in a moment.
2023-06-15 16:43:45 +01:00
Nick Mathewson 6da1acadab rpc: Rename Session=>RpcSession 2023-06-15 11:29:57 -04:00
Nick Mathewson 269fab7abe rpc: Expose Session object.
We'll want to move the responsibility for creating Sessions outside
the rpcmgr crate.
2023-06-15 11:28:34 -04:00
Nick Mathewson bd134525fd RPC: rename new_session to new_connection 2023-06-15 11:15:40 -04:00
Ian Jackson 1710ce54f4 rpc: Remove some verbiage about 'static, and demo that it's OK without
It's now not actually possible to write code that doesn't work, even
if `Tr` *isn't* 'static, because of the bounds on `CastTable::insert`.

I tried to produce a non-working setup with a non-static `Simple`, but
you can't implement `Object` for such a thing.  Removing 'static from
Object would stop the downcasts from Any to Object working.

Prior to the new typesafe insert, this change
  - let f: fn(&dyn $crate::Object) -> &(dyn $traitname + 'static) = |self_| {
  + let f: fn(&dyn $crate::Object) -> &(dyn $traitname) = |self_| {
would result in a runtime crash.  Now it results in a compiler error.
2023-06-15 12:07:11 +01:00
Ian Jackson 0eedf0e254 rpc: Give the name `O` to "the type associated with this CastTable"
This was locally bound to `S` in one place.  Bind and use it throughout.
Since this is an RPC object, `O` is a better name.

In each item, use the description once and thereafter just the name.
2023-06-15 12:03:53 +01:00
Ian Jackson 2228751a00 rpc: Add Simple test case for CastTable 2023-06-15 12:03:53 +01:00
Ian Jackson 54b364cdcf rpc: Move boxing from macro to CastTable::insert (formatting) 2023-06-15 12:03:53 +01:00
Ian Jackson 890a7b52be rpc: Move boxing from macro to CastTable::insert 2023-06-15 11:32:32 +01:00
Ian Jackson 8452fe11cf rpc: Make CastTable::insert be more type-safe
This checks the Requirements.
2023-06-15 11:13:26 +01:00
Nick Mathewson 84d9bd1d6a Merge branch 'ci' into 'main'
CI: Upgrade every-crate test to required

See merge request tpo/core/arti!1252
2023-06-14 19:19:22 +00:00
Ian Jackson bca999790f CI: Upgrade every-crate test to required
Since it passes now.
2023-06-14 19:49:13 +01:00
Nick Mathewson de423f6a36 rpc: switch GlobalId mac to KMAC. 2023-06-14 14:47:13 -04:00
Nick Mathewson 66a72370d1 rpc: connection_id _is_ used: remove a comment to the contrary 2023-06-14 14:46:08 -04:00
Nick Mathewson 789953d800 rpc: revise the relationship between Mgr and Connection
This adds a Weak reference from Connection to Mgr, makes DispatchTable
mutable, and makes a few other changes as discussed between me and
 Diziet the other week.

I bet we are not done tweaking this, but I hope it's a setp forwards.
2023-06-14 14:43:08 -04:00
Nick Mathewson d66ff621be Merge branch 'ci2' into 'main'
Test every crate with default features

See merge request tpo/core/arti!1250
2023-06-14 18:23:45 +00:00
Ian Jackson a156e60780 Merge branch 'pt-snowflake-fix' into 'main'
make snowflake example feature-gated

See merge request tpo/core/arti!1249
2023-06-14 18:13:57 +00:00
trinity-1686a 02a82ad748 make snowflake example feature-gated 2023-06-14 18:13:57 +00:00
Ian Jackson eeaae5a3bf CI: test every crate with default features 2023-06-14 18:47:51 +01:00
Ian Jackson 952bcb11ed CI: add script to test every crate with default features 2023-06-14 18:47:51 +01:00
Ian Jackson ab2ebcb910 Merge branch 'retry' into 'main'
impl HasRetryTime for various errors

See merge request tpo/core/arti!1246
2023-06-14 17:40:31 +00:00
Ian Jackson d277f6729d tor-hsclient: InvalidTarget::ImpossibleRelayIds is RetryTime::Never
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1246#note_2912105
2023-06-14 17:26:05 +01:00
Nick Mathewson 46a89ffb14 tor-hsclient: Correction to HasRetryTime for InvalidTarget doc 2023-06-14 17:26:05 +01:00
Ian Jackson c99207b60e tor-hsclient: Add doc for HasKind for FailedAttemptError
There is a cross-reference here to code (`IptSortKey`) in another
branch that I haven't made an MR for yet.
2023-06-14 17:26:05 +01:00
Ian Jackson d5bf90c33e tor-hsclient: Add docs and comments about HasRetryTime for InvalidTarget 2023-06-14 17:26:05 +01:00
Ian Jackson 3e8590c2b5 tor-cell: HasRetryTime for IntroduceAckStatus: Confirm re CANT_RELAY (fmt)
rustdoc insisted on misindenting this before, and now it insists on
un-mis-indenting it.
2023-06-14 17:26:05 +01:00
Ian Jackson fb4e33fbdf tor-cell: HasRetryTime for IntroduceAckStatus: Confirm re CANT_RELAY
Remove this todo as per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1246#note_2912104
2023-06-14 17:26:05 +01:00
Ian Jackson bfcddd4e59 tor-cell: Add a doc comment for impl tor_error::HasRetryTime for IntroduceAckStatus 2023-06-14 17:26:05 +01:00
Nick Mathewson f32b8cfaa2 netdoc::build: remove or narrow `allow`s. 2023-06-14 11:26:05 -04:00
Ian Jackson ea678ffa22 tor-hsclient: impl HasRetryTime for FailedAttemptError 2023-06-14 15:17:54 +01:00
Ian Jackson c4944de996 tor-hsclient: impl HasRetryTime for InvalidTarget 2023-06-14 15:16:31 +01:00
Ian Jackson f98c7df12e tor-cell: impl HasRetryTime for IntroduceAckStatus 2023-06-14 15:16:31 +01:00
Nick Mathewson ab56dcf145 Merge branch 'tor-cell-todos' into 'main'
Resolve most TODO HS comments in tor-cell

See merge request tpo/core/arti!1245
2023-06-13 22:30:50 +00:00
gabi-250 677148d077 Merge branch 'hscrypto-todos' into 'main'
hscrypto: Resolve all but one TODO HS comment.

See merge request tpo/core/arti!1244
2023-06-13 18:40:59 +00:00
Nick Mathewson 0912496dbb cell: Downgrade a couple more TODO HS comments. 2023-06-13 13:57:57 -04:00
Nick Mathewson 2fc0f83cdf Merge branch 'rotten-chutney' into 'main'
CI: integration-chutney: Turn into a warning

See merge request tpo/core/arti!1243
2023-06-13 17:06:02 +00:00