aboutsummaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
| * | rpc: Improve error reporting for invalid requestsNick Mathewson2023-04-127-17/+291
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a bit big, but it's not that _complicated_. The idea here is that we use serde's "untagged" enum facility when parsing our `Request`s, such that if parsing as a `Request` fails, we parse as an `InvalidRequest` and try to report what the problem was exactly. This lets us determine the ID of a request (if it had one), so we can report that ID in our error message. We can also recover from a much broader variety of errors. We now also conform with the spec reporting errors about completely wrong json, requests without IDs, and so on.
| * | rpcbase: Use correct error codes, and add tests.Nick Mathewson2023-04-122-7/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Well, mostly correct. Our current serde implementation doesn't tell us much about what went wrong with the object, so we can't tell why we couldn't convert it into a Request. Also, our output for the data field is not as the spec says: we should bring them into conformance. Part of #825.
| * | tor-error: Add ErrorKinds for RPC errors.Nick Mathewson2023-04-122-1/+25
| | | | | | | | | | | | | | | These are experimental for now so that we can change them without breaking semver.
| * | tor-rpcbase: Create error kinds properly.Nick Mathewson2023-04-121-14/+16
| | | | | | | | | | | | | | | The field is called "kinds", it is a list, and it holds strings beginning with "arti:".
| * | arti-rpcserver: Be careful about saying "result".Nick Mathewson2023-04-123-7/+12
| | | | | | | | | | | | | | | | | | 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.
| * | arti-rpcserver: Rename Authentication{Method => Scheme}.Nick Mathewson2023-04-121-7/+7
| | |
| * | arti-rpcserver: rename cmd to method.Nick Mathewson2023-04-121-2/+2
| | |
| * | arti-rpcserver: rename command to method.Nick Mathewson2023-04-122-19/+19
| | |
| * | tor-rpcbase: rename cmd to method everywhere.Nick Mathewson2023-04-121-31/+31
| | |
| * | tor-rpcbase: Rename cmd.rs to method.rs.Nick Mathewson2023-04-122-2/+2
| | |
| * | tor-rpcbase: Rename and rephrase "command" to "method"Nick Mathewson2023-04-127-54/+54
| | |
* | | Merge branch 'ticket_785' into 'main'Ian Jackson2023-04-121-0/+7
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | ExitPath: Add an explanation of WeightRole::Exit on non-exit circs Closes #785 See merge request tpo/core/arti!1135
| * | | ExitPath: Add an explanation of WeightRole::Exit on non-exit circsNick Mathewson2023-04-121-0/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Merge branch 'remove-hsdesc-todo' into 'main'Ian Jackson2023-04-121-3/+0
|\ \ \ | |/ / |/| | | | | | | | Remove misleading TODO. See merge request tpo/core/arti!1130
| * | Remove misleading TODO.Gabriela Moldovan2023-04-111-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `superencrypted` blob is, in fact, followed by a newline. See [core/torspec!122]. [core/torspec!122]: https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/122 Signed-off-by: Gabriela Moldovan <[email protected]>
* | | s/BridgeDescManager/BridgeDescMgr/g in codebaseNeel Chauhan2023-04-121-2/+2
| | |
* | | rpc: Try to fix rustdoc errors.Nick Mathewson2023-04-122-2/+2
| | |
* | | rpc: Use empty structs in test code.Nick Mathewson2023-04-121-12/+12
| | |
* | | Rename tor-rpccmd to tor-rpcbase.Nick Mathewson2023-04-1211-9/+9
| | |
* | | rpc: Make AuthenticationMethod an enum.Nick Mathewson2023-04-121-13/+20
| | |
* | | rpc: Reify and expose DispatchTable.Nick Mathewson2023-04-124-56/+88
| | |
* | | rpc: Change ConstTypeId_ to be a function that gets calledNick Mathewson2023-04-124-35/+33
| | | | | | | | | | | | | | | | | | | | | 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.
* | | rpc: Use Pin<Box<Stream/Sink>> for run_loopNick Mathewson2023-04-122-16/+24
| | |
* | | rpc: Import Pin/Context/Poll.Nick Mathewson2023-04-122-34/+18
| | | | | | | | | | | | | | | (Except for one case where we are using crate::Context and task::Context at the same time.)
* | | rpc: Document our intended read-blocking behavior.Nick Mathewson2023-04-121-0/+4
| | |
* | | rpc: Switch JsonLinesEncoder to have Default, not new.Nick Mathewson2023-04-122-6/+5
| | |
* | | rpc: Rename BoxedResponseBody => ResponseBodyNick Mathewson2023-04-123-18/+18
| | |
* | | rpc: Remove anyhow dependencyNick Mathewson2023-04-122-6/+13
| | |
* | | rpc: Add a demonstration feature to "arti"Nick Mathewson2023-04-122-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Reformat arti/Cargo.tomlNick Mathewson2023-04-121-9/+1
| | | | | | | | | | | | (This is what my editor wants to do to it.)
* | | rpc: Add standard warnings to arti-rpcserverNick Mathewson2023-04-125-7/+85
| | |
* | | rpc: Add an authentication step.Nick Mathewson2023-04-122-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | 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."
* | | RPC: add a temporary "listen" function.Nick Mathewson2023-04-123-1/+63
| | | | | | | | | | | | | | | It requires tokio, it's unix-only, and makes some unfortunate shortcuts. Probably good enough for initial testing.
* | | rpc: Declare a trivial Echo command that works on a session.Nick Mathewson2023-04-121-1/+24
| | |
* | | rpc: Wire up arti-rpcserver to use tor-rpccmd.Nick Mathewson2023-04-122-24/+159
| | |
* | | rpc: temporary converion functions for some error types.Nick Mathewson2023-04-121-0/+22
| | |
* | | rpc: Make all object lookup fns return LookupError.Nick Mathewson2023-04-122-9/+3
| | |
* | | rpc: Try refactoring the context type to _be_ a Sink.Nick Mathewson2023-04-122-45/+53
| | | | | | | | | | | | | | | | | | 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.
* | | tor-rpccmd: Apply standard warnings and make them pass.Nick Mathewson2023-04-126-8/+80
| | |
* | | rpc: Make a real test for our dispatch logic.Nick Mathewson2023-04-121-20/+83
| | |
* | | rpc: Remove type mangling from rpc_invoke_fn!Nick Mathewson2023-04-121-15/+14
| | | | | | | | | | | | | | | | | | 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.
* | | rpc: Add an RpcError type.Nick Mathewson2023-04-124-9/+59
| | | | | | | | | | | | | | | | | | 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.
* | | rpc: Make invoke return a Result of erased_serde::SerializeNick Mathewson2023-04-123-10/+40
| | | | | | | | | | | | | | | This will let the actual RPC functions return any Result type that we can serialize.
* | | rpc: Add Update functionality to rpc::Context.Nick Mathewson2023-04-123-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | 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?
* | | rpc: do a better job of hiding impl_const_type_id!Nick Mathewson2023-04-124-5/+67
| | |
* | | RPC: Initial implementation of a multiple-argument dispatchNick Mathewson2023-04-127-8/+401
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Start on a lower-level tor-rpccmd crate.Nick Mathewson2023-04-127-35/+94
| | | | | | | | | | | | | | | This crate will hold the backend pieces of RPC interaction that different parts of Arti get to implement.
* | | rpc: Add a Session object and an interaction loop.Nick Mathewson2023-04-122-0/+184
| | |
* | | rpc: Add asynchronous_codec wrapper for jsonlines.Nick Mathewson2023-04-123-0/+102
| | |
* | | rpc: Add a cancellable future type.Nick Mathewson2023-04-123-0/+136
| | | | | | | | | | | | | | | | | | 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`).