summaryrefslogtreecommitdiff
path: root/crates/arti-rpcserver
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate versions in preparation for v1.1.5 release.Nick Mathewson2023-06-011-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Run fixup-features script and resolve its complaints.Nick Mathewson2023-05-311-1/+1
|
* Merge branch 'rpc-auth-and-meta' into 'main'Nick Mathewson2023-05-245-105/+308
|\ | | | | | | | | rpc: authentication and basic handle manipulation See merge request tpo/core/arti!1200
| * rpc: Remove downgrade_owned for nowNick Mathewson2023-05-242-27/+0
| | | | | | | | | | | | | | Rationale: Our weak-vs-strong design is a bit confused at the moment due to concerns about deduplication and capability semantics. It's not clear that a general "change strong to weak" method is compatible with what we want to provide.
| * rpc: Disable auth:get_rpc_protocol for now.Nick Mathewson2023-05-241-0/+8
| |
| * rpc: Implement functionality to remove objects from a sessionNick Mathewson2023-05-243-5/+99
| | | | | | | | | | | | | | | | | | | | | | I've made doing some design choices here: * Reserving "rpc" as a prefix for post-authentication functionality that is not arti-specific. * Declaring these to be methods on the session rather than methods on the objects themselves. There's a problem with defining an API to drop a weak reference; see comment in code.
| * rpc: Make the top-level returned object a "session".Nick Mathewson2023-05-244-38/+67
| | | | | | | | | | | | This will make it easier to change the semantics of what exactly we return, whether it has to be/contain a client, whether you can use it to look up all the live objects, &etc.
| * rpc: Implement auth:query.Nick Mathewson2023-05-231-1/+39
| |
| * rpc: Implement the auth:get_rpc_protocol method.Nick Mathewson2023-05-231-0/+49
| |
| * rpc: move existing auth code to new module.Nick Mathewson2023-05-232-72/+84
| |
* | rpc: Remove fake_generational_arenaNick Mathewson2023-05-232-79/+2
|/ | | | | | | Now that generation-arena has merged [@diziet's patch] to clarify their license, we no longer need to disable it. [@diziet's patch]: https://github.com/fitzgen/generational-arena/pull/56
* Merge branch 'rpc-objectmap' into 'main'Nick Mathewson2023-05-163-180/+197
|\ | | | | | | | | | | | | RPC: revise semantics for weak references and object IDs Closes #848 See merge request tpo/core/arti!1183
| * rpc: Split the generational index into two.Nick Mathewson2023-05-161-113/+92
| | | | | | | | This lets us simplify our logic a bit for strong references.
| * rpc: Change the formatting of object IDsNick Mathewson2023-05-152-22/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want each ID to have a unique form every time it is given out, so that you can't use ID==ID to check whether Object==Object. (See discussions leading to #848.) We'd also like the form of object IDs to be a little annoying to analyze, to discourage people from writing programs that depends on their particular format. (We are reserving the right to change the format whenever we want.) We _don't_ want to use any cryptography here (yet), lest somebody think that this is an actual security mechanism. (This isn't for security; it's for encouraging developers to treat IDs as opaque.) With that in mind, we now lightly obfuscate our generational indices before returning them.
| * rpc: rename GenIdx::into/try_from implementationsNick Mathewson2023-05-152-11/+9
| | | | | | | | | | These are about to become nondeterministic-ish and probably shouldn't use the Into/TryFrom traits.
| * rpc: do not deduplicate strong object idsNick Mathewson2023-05-151-52/+39
| | | | | | | | | | | | | | | | Per discussion referenced at #848, we want each operation that returns a strong object ID to return a new, distinct strong ID. Note that we no longer need to put strong and weak references in the same arena; we can clean this code up a lot down the road.
| * rpc: Repair an error in our ObjectId encoding.Nick Mathewson2023-05-151-1/+1
| | | | | | | | | | | | Now we generate object IDs that we can parse. This is about to be obsolete once we change how we generate objects and their IDs for #848, but we may as well start from a working state.
* | Run fixup-features --no-annotate for initial Cargo.toml fixes.Nick Mathewson2023-05-151-1/+1
|/ | | | | | | | | 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`.
* objmap: move types to top of file.Nick Mathewson2023-05-041-74/+74
|
* Note/clean more TODOs in objmap.Nick Mathewson2023-05-041-1/+4
|
* RPC: Make the "client" return optional.Nick Mathewson2023-05-041-2/+2
|
* RPC: Make "Weak" and "Strong" entries separate.Nick Mathewson2023-05-041-43/+41
| | | | | | | | | Now there can be one of each, since we want references and handles to be conceptually separate. (The alternative would be to say that an operation either "returns a handle" or "returns a reference (which may become a handle) unless a handle already exists.")
* Temporarily replace generational-arena with a fake version.Nick Mathewson2023-05-042-2/+80
| | | | | This fake version is completely silly, but it will do the job until we figure out our MPL2 concerns.
* RPC: make arti-rpcserver require the arti-client/rpc featureNick Mathewson2023-05-041-1/+1
|
* RPC: Rename session.rs to connection.rsNick Mathewson2023-05-044-4/+4
|
* RPC: rename Session to Connection.Nick Mathewson2023-05-043-45/+48
| | | | | | | To me, "Session" suggests that we're authenticated, when we are not necessarily authenticated. Also, we may eventually want to have some kind of persistent session object; if we do, then we'll want Connections to be separate.
* RPC: Make authentication return a TorClient.Nick Mathewson2023-05-042-58/+66
| | | | | | (This is the correct capabilities-based behavior. For now it will only work if the TorClient uses a PreferredRuntime, but with luck we will find a solution for #837 soon.)
* Add a generational arena for object mapping for RPC.Nick Mathewson2023-05-043-0/+665
| | | | | | See the comments on `TypedAddr` for some explanations about why this is so tricky. Thanks to @diziet for helping me figure this out.
* RPC: Add "register" methods to RequestContext.Nick Mathewson2023-05-041-0/+8
|
* RPC: Start on plumbing TorClient into our RPC codeNick Mathewson2023-05-041-3/+8
| | | | | Because of #837, we won't be able to work with _every_ TorClient<R>, so I'm only going to be using TorClient<PreferredRuntime> for now.
* RPC: Move the "listen" part of the RPC listener code to `arti`.Nick Mathewson2023-05-045-68/+27
| | | | | | | | | Now there's a module in `arti` that runs the loop for an RPC listener. The part of the old `listener` module that made the framed connections is now part of the `Session` object. There is now yet another a temporary location for the pipe; we should pick something better. At least now it's configurable.
* rpc: Make an RpcMgr type to own the DispatchTable.Nick Mathewson2023-05-045-13/+56
| | | | | | | | | In the future, this will probably hold more data as well, like a TorClient and some configuration info. The TorClient will present an issue; I've made comments about that. Closes #820
* Upgrade tracing to 0.1.36.Nick Mathewson2023-05-031-1/+1
| | | | | | This is the first version to impl Value for String. With luck, this will get minimal_versions CI passing.
* Increment crate versions.Nick Mathewson2023-05-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* RPC: Log all internal errors.Nick Mathewson2023-04-191-1/+6
|
* Arti: Add ability to remember the list of methods names.Nick Mathewson2023-04-193-12/+17
| | | | | | | | | | | | Right now, this lets us say whether the method was unrecognized or whether the parameter type was incorrect. We'll use this to enforce correct method names later on. (I have to add another `inventory` here, since the `typetag` maintainer does not want to expose this functionality: see https://github.com/dtolnay/typetag/issues/57#issuecomment-1506106290 )
* rpcserver: Use with_fn.Nick Mathewson2023-04-192-12/+8
|
* rpc: Use Method types to determine type of method outputs, updates.Nick Mathewson2023-04-191-17/+39
| | | | This lets us do much less in our rpc_invoke_fn functions.
* rpc: Split Method into DynMethod and MethodNick Mathewson2023-04-192-19/+26
| | | | | Now `Method` has an Output and Update associated type, and `decl_method` can do a little more.
* Merge branch 'rpc_refactoring_v2' into 'main'Ian Jackson2023-04-181-141/+92
|\ | | | | | | | | | | | | A few RPC refactorings Closes #817 and #824 See merge request tpo/core/arti!1144
| * rpc: simplify API by always providing a sink.Nick Mathewson2023-04-161-7/+6
| | | | | | | | | | Previously we have two places where we had to do "make a `Drain` sink if updates aren't wanted"; now there's only one.
| * rpc: Ensure well-ordering of responses.Nick Mathewson2023-04-161-60/+88
| | | | | | | | | | | | | | | | | | | | | | | | Previously the main loop received updates via a `mpsc::channel`, and final responses via a `futures::unordered`. This could lead to final responses being transmitted to the user before the updates were all flushed. Now all of the responses are sent to the main loop via the same channel, and they can't get out-of-sequence. Closes #817 and (IMO) simplifies the code a bit.
| * rpc: Move update sink out of context.Nick Mathewson2023-04-161-101/+25
| | | | | | | | | | Now the update sink is its own boxed object. It is not yet passed to the invoke functions that want it.
* | rpcserver: Fix a couple of broken rustdoc linksNick Mathewson2023-04-162-3/+5
|/
* rpc: Change `id=<SYNTAX>` to "no id".Nick Mathewson2023-04-133-14/+32
| | | | | | | Now instead of hoping that buggy clients will detect a magic `id`, we can simply tell them that they will get no `id` at all. If they can't handle that case, no major harm is done: the connection will get closed anyway.
* rpc: Require that errors are RpcError.Nick Mathewson2023-04-133-7/+22
| | | | | | Since we're serializing everything in this format, let's enforce it. With this change, we can no longer cram arbitrary junk into an RPC error, so we have to clean up our handling of cancelled requests.
* 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.
* 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
|