Commit Graph

6351 Commits

Author SHA1 Message Date
Ian Jackson 835480e98f Merge branch 'remove-hsdesc-todo' into 'main'
Remove misleading TODO.

See merge request tpo/core/arti!1130
2023-04-12 16:52:59 +00:00
Nick Mathewson 2e017d3575 tor-rpcbase: Create error kinds properly.
The field is called "kinds", it is a list, and it holds strings
beginning with "arti:".
2023-04-12 12:27:16 -04:00
Nick Mathewson 873f9285af rpc spec: Change arti_kinds => kinds per discussion. 2023-04-12 12:20:24 -04:00
Nick Mathewson 6bdfc5740f arti-rpcserver: Be careful about saying "result".
Even though json-rpc uses "result" to mean "a successful return value
from a method", we can't: Rust's `Result` type is so pervasive
that confusion would be inevitable.
2023-04-12 12:08:53 -04:00
Nick Mathewson 4d82bf4b98 arti-rpcserver: Rename Authentication{Method => Scheme}. 2023-04-12 11:53:50 -04:00
Nick Mathewson 4327276922 arti-rpcserver: rename cmd to method. 2023-04-12 11:51:48 -04:00
Nick Mathewson b2b0a0dd83 arti-rpcserver: rename command to method. 2023-04-12 11:51:37 -04:00
Nick Mathewson 193253a158 tor-rpcbase: rename cmd to method everywhere. 2023-04-12 11:45:30 -04:00
Nick Mathewson 224b919835 tor-rpcbase: Rename cmd.rs to method.rs. 2023-04-12 11:26:12 -04:00
Nick Mathewson c5b70224b2 tor-rpcbase: Rename and rephrase "command" to "method" 2023-04-12 11:25:03 -04:00
Nick Mathewson ee5478ed40 rpc: terminology edits around "method" in spec draft
Always "method", never "command".

Always "authentication scheme", never "authentication method".
2023-04-12 11:11:01 -04:00
Nick Mathewson d492e644ab Merge branch 's101-q1' into 'main'
Update s101 values.

See merge request tpo/core/arti!1128
2023-04-12 14:53:36 +00:00
Nick Mathewson 2efdcd38ff ExitPath: Add an explanation of WeightRole::Exit on non-exit circs
In one case, we use WeightRole::Exit on circuits that can't
actually be used to exit.  This commit adds a comment to explain
why, so that we don't wonder about it in the future, and we have
some indication of whether it's still appropriate.

Closes #785
2023-04-12 09:50:16 -04:00
gabi-250 d72c794632 Merge branch 'bug805' into 'main'
s/Manager/Mgr/g in codebase

Closes #805

See merge request tpo/core/arti!1122
2023-04-12 13:18:33 +00:00
Neel Chauhan be78062bb6 s/BridgeDescManager/BridgeDescMgr/g in codebase 2023-04-12 05:49:11 -07:00
Nick Mathewson 6d401f67bb Merge branch 'rpc-hack' into 'main'
Initial hacking on RPC server

See merge request tpo/core/arti!1092
2023-04-12 12:48:16 +00:00
Nick Mathewson 8e6848b965 rpc: Try to fix rustdoc errors. 2023-04-12 08:02:30 -04:00
Nick Mathewson 44fbd87208 rpc: Use empty structs in test code. 2023-04-12 07:35:07 -04:00
Nick Mathewson 9a5f319a84 Rename tor-rpccmd to tor-rpcbase. 2023-04-12 07:34:57 -04:00
Nick Mathewson 5979272cc4 rpc: Make AuthenticationMethod an enum. 2023-04-12 07:34:57 -04:00
Nick Mathewson 0eb15ae592 rpc: Reify and expose DispatchTable. 2023-04-12 07:34:57 -04:00
Nick Mathewson ec247856fb rpc: Change ConstTypeId_ to be a function that gets called
We now _use_ the function pointers rather than comparing them; this
lets us drop our Eq/PartialEq/Hash implementations for
`ConstTypeId_` and instead just use `TypeId`s once we're in run-time
code.
2023-04-12 07:34:57 -04:00
Nick Mathewson a02a200ccd rpc: Use Pin<Box<Stream/Sink>> for run_loop 2023-04-12 07:34:57 -04:00
Nick Mathewson 3ad5d2f6ea rpc: Import Pin/Context/Poll.
(Except for one case where we are using crate::Context and
task::Context at the same time.)
2023-04-12 07:34:57 -04:00
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