summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
* Apply deferred rustfmt churnIan Jackson2024-10-092-6/+3
|
* memquota: Use an mq_queue for channel->circuit RX queueIan Jackson2024-10-092-7/+8
| | | | | | Fixes #1682. (This involves some noise in the tests.)
* memquota: Introduce type aliases for channel->circuit RX queueIan Jackson2024-10-092-7/+6
| | | | | This is neater and will make changing the type (in a moment) less noisy.
* tor-proto: Make circuit->channel queues participate in memquotaIan Jackson2024-10-031-1/+2
| | | | | | | | We use the *channel*'s memquota account. This is arguably wrong, but it's hard to get right now. See #1652. Change the type of the queue, and the places it's constructed. The use sites can all stay the same.
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-032-4/+22
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-proto: Plumb the ChannelAccount through to queue creation site (pre-fmt)Ian Jackson2024-10-031-1/+5
|
* tor-proto: channel: Make construction fallibleIan Jackson2024-10-032-3/+4
| | | | | Making a channel is going to involve making a memquota Participant, which can fail.
* tor-proto: Add a CoarseTimeProvider bound to all the SleepProviders (fmt)Ian Jackson2024-10-011-4/+14
|
* tor-proto: Add a CoarseTimeProvider bound to all the SleepProvidersIan Jackson2024-10-011-8/+8
| | | | | | | The memquota arranagements are going to use this. We *don't* apply this to Channel (or to other types that aren't already generic over SleepProvider).
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-282-5/+4
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* UnverifiedChannel: Clarify check's peer_certClara Engler2024-07-111-1/+1
| | | | | | | This commit clarifies the documentation of the `peer_cert` parameter in the `UnverifiedChannel::check` function, in order to reflect that it represents the certificate presented during the ServerHello in the TLS handshake and not in the in-protocol CERTS cell.
* proto: Divide up some elements of ChannelDetails.Nick Mathewson2024-05-161-2/+4
| | | | | | | | | | | | | | Previously ChannelDetails had a double duty: It held elements shared among the clones of a Channel, and it also held elements shared between the Channel and the Reactor. But now that Channel doesn't have to implement Clone, we can more the non-Reactor elements into Channel itself. This change may improve cache locality a bit, and should make it a little easier to follow the channel code. I've also moved unique_id out of ChannelDetails into Channel _and_ Reactor: it is small, immutable, and used all the time in logging.
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-162-2/+2
| | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* Use uXX::MAX in place of std::uXX::MAXNick Mathewson2024-04-221-1/+1
| | | | | | The old code produced a warning from clippy nightly; we may as well update to use the new associated consts. (They've been there since Rust 1.4x.)
* Run maint/add_warning.Nick Mathewson2024-03-133-0/+3
|
* clippy: Replace many calls to .get(0) with .first()Ian Jackson2024-01-021-1/+1
| | | | | FTR I don't think agree with clippy on this question, but then I often don't.
* Downgrade some messages to traceIan Jackson2023-11-291-1/+1
| | | | | These messages are very verbose and I doubt anyone will want them, usually, even when debugging.
* Change `CircId` to never be zeroJim Newsome2023-10-253-46/+81
| | | | | | | | | | This changes the internal representation to be `NonZeroU32` instead of just `u32`. Various places where a circuit ID is optional now use `Option<CircId>`. Fixes a bug in `CircIdRange::sample` that would previously return a circuit ID of 0, when the rng returned 0x8000_0000 for a low range.
* Upgrade to latest asynchronous_codec (0.7.0)Nick Mathewson2023-10-171-2/+2
|
* oneshot: Use veneer in tor-protoIan Jackson2023-10-112-5/+8
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-233-0/+3
|
* test: add a test for missing NETINFO cellsEmil Engler2023-08-121-0/+15
| | | | | | This commit adds a unit test to the `tor_proto::handshake` module, which tests the behavior when no NETINFO cell is present within a channel.
* proto: methods to wait until a channel/circuit is shut down.Nick Mathewson2023-08-041-0/+7
| | | | | | | | | | | | | | | | | | The implementation here is perhaps excessively simple: we put a `oneshot::Sender` in the `Reactor` object, and a `Shared<oneshot::Receiver>` in the circuit or channel. When the reactor is dropped, any copy of the `Shared<Receiver>` will yield `Err(Cancelled)`. I'm marking these methods as experimental because I'm not sure I've thought of all the implications here, and we might want to change things around. Down the road, these methods might want to yield a `Result<>` indicating why the reactor was shut down. This feature was inspired by a request from Saksham Mittal, and a felt need while working on !1472.
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-103-0/+3
|
* tor-proto: Remove use of arrayref.Nick Mathewson2023-06-011-2/+5
|
* Replace usage of KeyUnknownCert::check_key.Nick Mathewson2023-05-161-2/+2
|
* async-utils: rename SinkExt to SinkPrepareExtNick Mathewson2023-04-191-1/+1
|
* Move functionality from tor_basic_utils to tor_async_utilsNick Mathewson2023-03-291-1/+1
| | | | | This commit is mostly code movement; I'd recommend reviewing it with git's `--color-moved` option.
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-1/+0
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2CNick Mathewson2023-02-091-20/+20
|
* tor-proto: Do not parse forbidden commands on inbound cells.Nick Mathewson2023-02-091-84/+28
| | | | | | | | | | Unlike C tor, we treat unrecognized commands as reason to kill off the connection entirely. That's fine; if we need to add an unrecognized command in the future, we can use VERSIONS to negotiate it. Also, if someday we want this code to support relay channels as well, we can use some type trickery to have that work too.
* tor-proto: only parse allowed ChanMsg types during handshake.Nick Mathewson2023-02-092-28/+97
|
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-073-42/+42
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-073-2/+3
|
* tor-cell: Use macro to generate ChanMsg too.Nick Mathewson2023-02-072-3/+3
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-273-0/+3
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* tor-proto: rustfmtIan Jackson2023-01-061-1/+2
| | | | Not sure why the tree didn't have this newline already. "Whatever".
* tor-proto: When relay IDs mismatch, the IDs are sensitive in errorsIan Jackson2023-01-061-2/+4
|
* Merge branch 'test-lints' into 'main'eta2023-01-062-0/+17
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-122-0/+17
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | Use parse_rfc3339() in the tor-proto crateNeel Chauhan2022-12-161-1/+2
| |
* | Merge branch 'err-dyn-report' into 'main'Ian Jackson2022-12-151-1/+1
|\ \ | | | | | | | | | | | | Error logging (ErrorReport, .report()) POC See merge request tpo/core/arti!936
| * | tor-proto: reactor tests: Use debug fmt on an errorIan Jackson2022-12-121-1/+1
| |/ | | | | | | | | | | | | In tests, debug fmt is usually appropriate. Found while looking for a candidate for https://gitlab.torproject.org/tpo/core/arti/-/issues/680
* / Tackling issue #663 (Use humantime in tests)coral2022-12-121-1/+1
|/
* Merge branch 'rename_for_to_from' into 'main'Nick Mathewson2022-10-251-2/+2
|\ | | | | | | | | tor-cell: Rename for_client and for_relay See merge request tpo/core/arti!793
| * tor-cell: Rename for_client and for_relayEmil Engler2022-10-211-2/+2
| | | | | | | | | | | | | | This commit renames the for_client and for_relay functions to from_client and from_relay respectively, in order to indicate their origin, as the term "for" is more likely to indicate a destination, which is not true in that situation.
* | linkspec: Remove now-useless declared_peer_addrNick Mathewson2022-10-241-3/+4
|/ | | | The singleton variation here is almost never what we want.
* Allow "clippy::single_char_pattern" in tests.Ian Jackson2022-10-121-0/+1
| | | | | | | This lint exists for perf reasons, and this is rarely relevant in tests. Using double quoted str is generally cognitively less burdensome.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-111-2/+2
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* Clarify limits on socket address from ChannelMethodNick Mathewson2022-10-061-2/+2
|