Commit Graph

6377 Commits

Author SHA1 Message Date
Nick Mathewson 8845309125 rpc: Document our intended read-blocking behavior. 2023-04-12 07:34:57 -04:00
Nick Mathewson ed1cbce13a rpc: Switch JsonLinesEncoder to have Default, not new. 2023-04-12 07:34:57 -04:00
Nick Mathewson 03937e35b2 rpc: Rename BoxedResponseBody => ResponseBody 2023-04-12 07:34:57 -04:00
Nick Mathewson 07bb57a4c2 rpc: Remove anyhow dependency 2023-04-12 07:34:57 -04:00
Nick Mathewson 4c020de38c Add notes on how to test the RPC engine 2023-04-12 07:34:57 -04:00
Nick Mathewson 3648ea08c9 Add notes on how to test the RPC engine 2023-04-12 07:34:57 -04:00
Nick Mathewson 06b2180907 rpc: Add a demonstration feature to "arti"
It's experimental, and tokio-only.  To enable it, build with
the "rpc" feature turned on, and connect to
`~/.arti-rpc-TESTING/PIPE`.  (`nc -U` worked for me)

I'll add some instructions.
2023-04-12 07:34:57 -04:00
Nick Mathewson 074dd704f4 Reformat arti/Cargo.toml
(This is what my editor wants to do to it.)
2023-04-12 07:34:57 -04:00
Nick Mathewson ff68a5f02a rpc: Add standard warnings to arti-rpcserver 2023-04-12 07:34:57 -04:00
Nick Mathewson b024fe5596 rpc: Add an authentication step.
Per our design, every connection starts out unauthenticated, and
needs one authenticate command to become authenticated.

Right now the only authentication type is "This is a unix named
socket where everybody who can connect has permission."
2023-04-12 07:34:57 -04:00
Nick Mathewson f9de7929c1 RPC: add a temporary "listen" function.
It requires tokio, it's unix-only, and makes some unfortunate
shortcuts.  Probably good enough for initial testing.
2023-04-12 07:34:57 -04:00
Nick Mathewson 3e64cab62d rpc: Declare a trivial Echo command that works on a session. 2023-04-12 07:34:57 -04:00
Nick Mathewson 41cba18899 rpc: Wire up arti-rpcserver to use tor-rpccmd. 2023-04-12 07:34:57 -04:00
Nick Mathewson 5a41ac34d5 rpc: temporary converion functions for some error types. 2023-04-12 07:34:57 -04:00
Nick Mathewson 0cba074786 rpc: Make all object lookup fns return LookupError. 2023-04-12 07:34:57 -04:00
Nick Mathewson 74706683c7 rpc: Try refactoring the context type to _be_ a Sink.
This lets us avoid async_trait in tor-rpccmd, and makes us use a
Box<>.  I think we might actually get an even smarter type later on,
but we will need to play with this for a while too.
2023-04-12 07:34:57 -04:00
Nick Mathewson 7a81f4b01b tor-rpccmd: Apply standard warnings and make them pass. 2023-04-12 07:34:57 -04:00
Nick Mathewson 154accc05a rpc: Make a real test for our dispatch logic. 2023-04-12 07:34:57 -04:00
Nick Mathewson 5a2c9d7da1 rpc: Remove type mangling from rpc_invoke_fn!
Now the user has to say that the fn takes an
Arc<>, a Box<>, and an Arc<dyn>.  Previously, they had to pretend
that it didn't.
2023-04-12 07:34:57 -04:00
Nick Mathewson dce9c530ec rpc: Add an RpcError type.
This could have been a trait instead, but I don't know whether
that's smart or not.  There is a lot of opportunity for refactoring
here.
2023-04-12 07:34:57 -04:00
Nick Mathewson dec23c1cf6 rpc: Make invoke return a Result of erased_serde::Serialize
This will let the actual RPC functions return any Result type that
we can serialize.
2023-04-12 07:34:57 -04:00
Nick Mathewson 83b908aa3e rpc: Add Update functionality to rpc::Context.
I'm not sure about these APIs at all!  They force us to use
`async_trait` for `tor_rpccmd::Context`, which bothers me. Should we
just have a function that returns
`Option<Box<dyn Sink<Item=X, Error=Y>>` or something?  If so,
what's the correct Y?
2023-04-12 07:34:57 -04:00
Nick Mathewson 3fbcead7dc rpc: do a better job of hiding impl_const_type_id! 2023-04-12 07:34:57 -04:00
Nick Mathewson e26d9452dc RPC: Initial implementation of a multiple-argument dispatch
This code uses some kludges (discussed with Ian previously and
hopefully well documented here) to get a type-identifier for each
type in a const context.  It then defines a macro to declare a
type-erased versions of a concrete implementation functions, and
register those implementations to be called later.

We will probably want to tweak a bunch of this code as we move ahead.
2023-04-12 07:34:57 -04:00
Nick Mathewson a4660a4e09 Start on a lower-level tor-rpccmd crate.
This crate will hold the backend pieces of RPC interaction that
different parts of Arti get to implement.
2023-04-12 07:34:57 -04:00
Nick Mathewson 6e3f3b4dfc rpc: Add a Session object and an interaction loop. 2023-04-12 07:34:57 -04:00
Nick Mathewson 5247486cfc rpc: Add asynchronous_codec wrapper for jsonlines. 2023-04-12 07:34:57 -04:00
Nick Mathewson a662fb1296 rpc: Add a cancellable future type.
Ordinarily you can cancel a future just by dropping it, but we'll
want the ability to cancel futures that we no longer own (because we
gave them to a `FuturesUnordered`).
2023-04-12 07:34:57 -04:00
Nick Mathewson 0779d405cf rpc: Implement json message types for serde. 2023-04-12 07:34:57 -04:00
Nick Mathewson 3f269449cb tor-proto: Be explicit about an into().
This is a workaround for an issue that I'm about to encounter
somewhere in our pile of dependencies as I add arti-rpcserver, and
somehow make serde_json visible in this test code thereby, making
the PartialEq method resolution ambiguous.
2023-04-12 07:34:57 -04:00
Nick Mathewson d6375ef0fd Add another entry to global semver.md 2023-04-12 07:33:46 -04:00
gabi-250 b93e7bbda5 Merge branch 'audit' into 'main'
Run cargo audit last and in its own job

See merge request tpo/core/arti!1133
2023-04-12 11:32:05 +00:00
gabi-250 77f4e5dc74 Merge branch 'fix' into 'main'
tor-hsclient: Add an allow to this incomplete code

See merge request tpo/core/arti!1134
2023-04-12 11:31:17 +00:00
Ian Jackson 3caa8e61e9 tor-hsclient: Add an allow to this incomplete code
Fixes CI warning.
2023-04-12 11:50:27 +01:00
gabi-250 89cfca3a2e Merge branch 'fix' into 'main'
Apply ProtocolViolation renaming to hs connector code

See merge request tpo/core/arti!1132
2023-04-12 10:09:31 +00:00
Ian Jackson 44d76afa7c Run cargo audit last and in its own job
Recently we had some minor awkwardness due a new advisory.
This may help in future.
2023-04-12 10:55:25 +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
Ian Jackson b6533b31aa Merge branch 'msrv-1.65' into 'main'
Increase Arti MSRV to 1.65

Closes #815

See merge request tpo/core/arti!1131
2023-04-12 09:34:05 +00:00
Nick Mathewson c596ded74a Merge branch 'bug804' into 'main'
s/ProtocolFailed/ProtocolViolation/g where possible

Closes #804

See merge request tpo/core/arti!1121
2023-04-11 21:33:25 +00:00
Nick Mathewson 6f9ceda6ca Add a global semver.md for MSRV break. 2023-04-11 15:38:14 -04:00
Nick Mathewson d2e742f2ef Test with 1.65 in minimal_versions. 2023-04-11 15:34:36 -04:00
Nick Mathewson d34d91a1dc Update MSRV in README 2023-04-11 15:33:49 -04:00
Ian Jackson 05fd027be2 Merge branch 'rpc2' into 'main'
rpc: Proposed error format

See merge request tpo/core/arti!1107
2023-04-11 19:33:45 +00: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 b8b02b38f1 Merge branch 'hs' into 'main'
Download HS descriptors

See merge request tpo/core/arti!1118
2023-04-11 19:19:48 +00:00
Ian Jackson 4b28b470a2 Merge branch 'warning' into 'main'
Fix two rustdoc warnings

See merge request tpo/core/arti!1114
2023-04-11 19:02:33 +00:00
Nick Mathewson b9b5e9940a rpc: Fix typos/grammar errors 2023-04-11 20:02:01 +01:00
Ian Jackson 0be641e49a rpc: Rewrite `data` spec in JSON terms 2023-04-11 20:02:01 +01:00
Ian Jackson 3ac94956ef rpc: Clarify that error formatting display is indicative 2023-04-11 20:02:01 +01:00