summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | | | rpc: Simplify simplified close logic even furtherNick Mathewson2024-09-162-35/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of classifying errors and complicating our behavior _early_ in our loop, instead we just decide whether an error indicates an EOF immediately before we return it.
| * | | | | | rpc: Simplify close logic even further.Nick Mathewson2024-09-161-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make it more clear than the previous match statement that once we get an Err() from request_stream.next(), we aren't going to continue the loop.
| * | | | | | rpc: Simplify handling of fatal Json read errors.Nick Mathewson2024-09-163-44/+33
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, after determining that an error on an RPC connection was fatal, we would: 1. Determine whether it was a "clean" close or one that needed to be logged. 2. In exactly one case (specifically, when the inbound Json stream contained a Value that was not an Object) , we would send back a message to the client. 3. Exit the connection with Ok() or Err(e). We no longer do step "2" above. Additionally, we document: - Why it's important to exit immediately on syntax errors. - A better way to tolerate non-Object Json Values, if we decide someday to do so. Closes #1591.
* | | | | | Merge branch 'circmgr-remove-abstractspec' into 'main'Nick Mathewson2024-09-164-260/+328
|\ \ \ \ \ \ | |/ / / / / |/| | | | | | | | | | | | | | | | | tor-circmgr: Remove AbstractSpec and FakeSpec. See merge request tpo/core/arti!2412
| * | | | | Add test for CircList::find_open.Wesley Aptekar-Cassels2024-09-161-1/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tests that when requesting preemptive circuits, they are not given out when a insufficient number of circuits are in the CircList, but that they are given out once the required number of circuits has been reached.
| * | | | | tor-circmgr: Remove AbstractSpec and FakeSpec.Wesley Aptekar-Cassels2024-09-164-260/+274
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AbstractSpec and FakeSpec actually make testing more difficult, since they prevent using FakeBuilder in code that relies on the concrete TargetCircUsage and SupportedCircUsage types. Removing them means FakeBuilder can be used in more places, and also means that the test code is closer to the real code, since TargetCircUsage and SupportedCircUsage are now exercised directly in more tests. This did require making one change to a test, which I think was previously testing behaviour that was true for FakeSpec but not for the real code: The mgr::test::isolated test previously asserted that, in the case where three circuits were requested, two with isolation and one without, the non-isolated circuit would be shared with one of the isolated circuits. This was allowed by the FakeSpec::supports function. However, in the actual code, the path is as follows: * AbstractCircMgr::get_or_launch * AbstractCircMgr::prepare_action * CircList::find_open * AbstractSpec::find_supported * abstract_spec_find_supported * OpenEntry::supports * SupportedCircUsage::supports * StreamIsolation::compatible_same_type StreamIsolation::compatible_same_type checks owner_type, which is always zero for non-isolated streams and always non-zero for isolated streams, meaning that a isolated stream will never be compatible with a non-isolated stream. The seems like desirable behaviour, so I simply modified the test to make four connections, two isolated and two not, and checked that the isolated streams never share any circuits, and that the two non-isolated streams use the same circuit. As far as I can tell, this is the intended behaviour in the existing code.
* | | | | Merge branch 'proxy-subcmd' into 'main'Nick Mathewson2024-09-163-188/+224
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | arti: Move proxy subcommand to a separate module. See merge request tpo/core/arti!2416
| * | | | arti: Move proxy subcommand to a separate module.Gabriela Moldovan2024-09-122-41/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No functional changes, this is just code motion. This helps organize the code in `arti/src/lib.rs` a bit. It now only contains the argument parsing and various other setup, and all the subcommands are contained in separate modules.
| * | | | arti: Move arti::run to subcommands::proxy.Gabriela Moldovan2024-09-122-156/+172
| | | | | | | | | | | | | | | | | | | | No functional changes, this is just code motion.
| * | | | arti: Add a new module for the proxy subcommand.Gabriela Moldovan2024-09-122-0/+19
|/ / / / | | | | | | | | | | | | | | | | The implementation for `arti proxy` will soon be relocated to this new module.
* | | | Merge branch 'orport' into 'main'David Goulet2024-09-127-30/+170
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | tor-chanmgr: add experimental `ChanMgr::handle_incoming` See merge request tpo/core/arti!2389
| * | | | tor-chanmgr: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-117-4/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The channel manager in the future will need to be able to receive incoming streams. The type of the stream depends on an associated type within `ChannelFactory`, so this commit exposes this associated type through several other types, eventually to the `ChanMgr`. The new methods are behind the experimental "relay" feature flag.
| * | | | tor-chanmgr: make `CompoundFactory` generic over `ChannelFactory`Steven Engler2024-09-112-30/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This has two advantages: 1. Code is a little easier to follow with generics rather than dynamic dispatch, especially since the type is fixed at compile time anyways. 2. It allows us to access associated types of the `ChannelFactory`, which will be useful later for getting the stream type from the `ChanBuilder`.
* | | | | Merge branch 'rpc_proxy_info_fix' into 'main'Ian Jackson2024-09-121-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | rpc: Fix argument type for rpc_session_get_rpc_proxy_info See merge request tpo/core/arti!2409
| * | | | | rpc: Fix argument type for rpc_session_get_rpc_proxy_infoNick Mathewson2024-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without this, we get a panic on startup when running with RPC! (This stresses the need for an integration test for RPC; I will start writing that after the Python wrapper lands.)
* | | | | | Merge branch 'rpc-rename-conn-to-stream' into 'main'Ian Jackson2024-09-124-27/+23
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | rpclib: Rename connect.rs to stream.rs, and "connect" identifiers to "open_stream" See merge request tpo/core/arti!2406
| * | | | | | rpclib: Remove TODO about connect=>stream renaming.Nick Mathewson2024-09-101-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AFIACT, all of this renaming is done. I've grepped for `[Cc]onn` and didn't find any more identifiers that needed to be renamed.
| * | | | | | rpclib: Rename "connect" to "open_stream" as appropriate.Nick Mathewson2024-09-103-21/+21
| | | | | | |
| * | | | | | rpclib: Rename connect.rs to stream.rsNick Mathewson2024-09-102-2/+2
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This is about DataStreams, so we should make it less confusing. This commit is _just_ about the file renaming, with no associated function renaming.)
* | | | | | Merge branch 'inert-client-docs' into 'main'David Goulet2024-09-121-43/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | arti-client: Remove duplicated documentation. See merge request tpo/core/arti!2414
| * | | | | | arti-client: Convert a note to a comment.Gabriela Moldovan2024-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This was supposed to be a comment, not part of the docs.
| * | | | | | arti-client: Remove duplicated documentation.Gabriela Moldovan2024-09-121-42/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `TorClient` and `InertTorClient` have a number of identical state-management functions. This makes the `InertTorClient` link to the `TorClient` docs instead of duplicating them.
* | | | | | | Merge branch 'reader-3' into 'main'Ian Jackson2024-09-1217-255/+414
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rework tor_bytes::Truncated Closes #1614 See merge request tpo/core/arti!2407
| * | | | | | | tor-bytes: Fix Truncated refs in various docs.Ian Jackson2024-09-121-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use "throws" terminology to avoid having to clutter the description with Err(). Many of these doc comments contain otiose text such as "returns Ok(()) on success" but let's not deal with that now.
| * | | | | | | tor-bytes: Rename OnIncomplete to Completeness (fmt)Ian Jackson2024-09-121-1/+1
| | | | | | | |
| * | | | | | | tor-bytes: Rename OnIncomplete to CompletenessIan Jackson2024-09-121-11/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And rename its variants and update the docs to contemplate wider use, as suggested in #1620. As discussed here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075658
| * | | | | | | tor_bytes: Clarify a method docIan Jackson2024-09-121-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Apropos https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075638
| * | | | | | | tor_bytes: Rename new_truncated_for_test to new_incomplete_for_test (fmt)Ian Jackson2024-09-121-2/+8
| | | | | | | |
| * | | | | | | tor_bytes: Rename new_truncated_for_test to new_incomplete_for_testIan Jackson2024-09-124-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No semver implications since this wasn't in the last release.
| * | | | | | | tor-bytes: Add test case for from_possibly_incomplete_sliceIan Jackson2024-09-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075486
| * | | | | | | tor-bytes: Add note about other kinds of invalid messageIan Jackson2024-09-111-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075485
| * | | | | | | tor-bytes: Add imprecations about Incomplete and MissingDataIan Jackson2024-09-111-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075483
| * | | | | | | tor-bytes: Fix a doc comment about error reportingIan Jackson2024-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a leftover from before I invented Error::MissingData.
| * | | | | | | tor-bytes: Do many missed renames of Truncated to IncompleteIan Jackson2024-09-113-9/+9
| | | | | | | |
| * | | | | | | tor-bytes: Add warning about sub-readers (adjust to new name)Ian Jackson2024-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix semantic conflict of the suggested edit with the rename later in the branch.
| * | | | | | | tor-bytes: Add warning about sub-readersIan Jackson2024-09-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggestion from here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2407#note_3075481
| * | | | | | | tor-bytes: Update semver.md. No compile-breaking changes, now.Ian Jackson2024-09-111-1/+2
| | | | | | | |
| * | | | | | | tor-bytes: Rename Truncated to Incomplete, and restore old Truncated as ↵Ian Jackson2024-09-115-8/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | deprecated Incomplete is a better name. This lets us use Truncated for the old, deprecated, conflation of "Incomplete" with what is now "MissingData".
| * | | | | | | tor-bytes: Only report Truncated for errors at the outer level (fmt)Ian Jackson2024-09-111-2/+10
| | | | | | | |
| * | | | | | | tor-bytes: Only report Truncated for errors at the outer levelIan Jackson2024-09-114-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is item 1 from https://gitlab.torproject.org/tpo/core/arti/-/issues/1614#note_3074562 and the alternative to item 2 presented in the 2nd half of https://gitlab.torproject.org/tpo/core/arti/-/issues/1614#note_3074648 (Item 3 was done earlier, but now we change the behaviour.) Fixes #1614.
| * | | | | | | tor-bytes: Error: provide and call Error::incomplete_error (tidy)Ian Jackson2024-09-111-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tidy up an error message. Now this can be on one line with variable name interpolation.
| * | | | | | | tor-bytes: Error: provide and call Error::incomplete_error (fmt)Ian Jackson2024-09-112-8/+11
| | | | | | | |
| * | | | | | | tor-bytes: Error: provide and call Error::incomplete_errorIan Jackson2024-09-114-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We introduce the new constructor and call it at the error generation sites. But there is still not yet any functional change. Change the type of Truncated's field to be Sensitive. The original reason for not doing this no longer applies, since we don't generally want to open-code construction of this variant. Conveniently, changing the type means we get to find all the sites where one *is* constructed and adjust them. In reader.rs and tor-proto we can just call incomplete_error. In tor-cell, there's a call site where we previously provided an underestimate, and where the Reader isn't available. We adjust that ad-hoc but this is fine because the error variant will change. (relaycell is using a Reader from from_slice.)
| * | | | | | | tor-bytes: Add a Reader constructor for tor-socksproto's use caseIan Jackson2024-09-113-11/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Here we add the constructor, and document it, and change the call sites. No functional change yet.
| * | | | | | | tor-bytes: Add a test case with missing inner dataIan Jackson2024-09-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some tests in other crates test this, but none in tor-bytes!
| * | | | | | | tor-bytes: Add a Reader constructor for use in testsIan Jackson2024-09-115-25/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We could call from_possibly_incomplete_slice in these, but that's confusing and distracting. Here we add this constructor, and document it (in terms of the constructor to come), and change the call sites. No functional change. Doing this now will prevent unwanted changes to test behaviours when we change the behaviour of Readers made by Reader::from_slice.
| * | | | | | | tor-bytes: derive impl PartialEq for ErrorIan Jackson2024-09-113-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I just perpetrated a bug by adding a variant to this which ended up not PartialEq to itself. This open-coded match is a footgun. No functional change.
| * | | | | | | tor-cell: No longer treat certain tor-bytes errors as EK::InternalIan Jackson2024-09-111-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't see a justification for this. Rather than updating this code for the new distinction between what is going to be Incomplete (ie, our buffer didn't contain enough data and we want to read more) and MissingData, I think we can just do away with it. Perhaps in the future, tor_bytes::Error would implement HasKind.
| * | | | | | | Change tor_bytes::Readable name to `b` in many placesIan Jackson2024-09-115-160/+160
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The codebase uses `r` sometimes and `b` at other times. Making this consistent makes widespread changes easier, and is clearer for humans. I think `b` is better than `r` because `r` might be "return". It is indeed used that way in a couple of places in reader.rs, even. I haven't changed *everywhere*, just Readable impls (where `r` is particularly likely to be "return value") and occurrences in tor-bytes. No functional change.
* | | | | | | Merge branch 'single-onion-svc' into 'main'Nick Mathewson2024-09-125-33/+17
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | tor-hsservice: Remove the anonymity setting from the config. See merge request tpo/core/arti!2413