aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/util
Commit message (Collapse)AuthorAgeFilesLines
* proto: Rework error handling in `HopMgr::get_or_spawn_reactor()`Gabriela Moldovan2026-06-231-1/+20
| | | | | | | | | | This reworks `get_or_spawn_reactor()` to return `Error` instead of `ReactorError`. The main change here is that we now have a dedicated `Error::Spawn` variant for `SpawnError`s, instead of mapping these to `ReactorError` (which actually triggers a clean shutdown, which is not quite what we want here).
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-0911-0/+11
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* proto: Move RateLimitedWriter to tor-async-utilsDavid Goulet2026-06-083-763/+0
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Move TokenBucket to tor-basic-utilsDavid Goulet2026-06-083-848/+3
| | | | Signed-off-by: David Goulet <[email protected]>
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-1/+1
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* proto: Remove an allow for a now-pedantic warning.Nick Mathewson2026-05-071-6/+0
|
* tor-proto: Port to web-time-compatNick Mathewson2026-03-264-8/+12
|
* Fix typosTobias Stoeckmann2026-03-241-1/+1
| | | | Typos found with codespell
* proto: Check the AUTHENTICATE auth type that we support itDavid Goulet2026-03-191-0/+9
| | | | | | | | As a responder, we should check the AUTHENTICATE auth type and make sure we support it. We were not doing that, we were simply putting in our max version. Signed-off-by: David Goulet <[email protected]>
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* Revert "proto: Add a new ToRelayMsg util"Gabriela Moldovan2026-02-121-24/+0
| | | | | | | | | | This reverts commit 04ab3cd848d7977baf58dd64ebfcad6aa54ecb17. Reverted because we no longer need to "peek" into the opaque `CircChanMsg` of a circuit reactor: now the implementation-dependent part of the reactor is in charge of handling the channel messages, and extracting `Relay` objects out of RELAY/RELAY_EARLY cells, which then get processed in the base reactor.
* proto: Add new LinkspecDecodeErr kindGabriela Moldovan2026-02-051-0/+15
| | | | | | This will be needed by relays, for wrapping tor_linkspec decode errors (which can happen if the link specifiers in the EXTEND2 cell can't be converted to a channel target).
* proto: Add a new ToRelayMsg utilGabriela Moldovan2026-01-291-0/+24
| | | | | | | | | This will be used in a future commit, inside the new generic circuit reactor. We need it because RELAY cells are handled very similarly, so we need some way of finding out if a given generic chancell is actually a RELAY cell that we can handle in an implementation-agnostic way.
* proto: Move TimeoutEstimator to utilGabriela Moldovan2026-01-291-0/+13
| | | | | This will be used in the stream reactor too (and the stream reactor will eventually replace the corresponding client impl).
* proto: Add docs for ExcessPaddingGabriela Moldovan2025-12-011-0/+1
|
* proto: run add_warning to update tunnel_activity.rsNick Mathewson2025-11-121-1/+1
|
* proto: assert that no member of InTunnelActivity needs_drop.Nick Mathewson2025-11-121-1/+15
|
* proto: Use a ZST-token pattern to enforce correctness for TunnelActivityNick Mathewson2025-11-122-14/+58
|
* tor-proto: Track information on when tunnels were last usedNick Mathewson2025-11-122-1/+187
| | | | This is part of an implementation for proposal 368.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-0610-10/+10
| | | | Run maint/add_warning
* all: run cargo fmtSteven Engler2025-11-042-2/+2
|
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-043-3/+3
|
* tor-proto: bring back comparison chain w/ allowhashcatHitman2025-10-081-9/+14
| | | | | | | | It was decided that the comparison chain was actually preferrable for readability. So instead, we're just `allow`ing it until it stops being a problem. Signed-off-by: hashcatHitman <[email protected]>
* tor-proto: replace comparison chain with matchhashcatHitman2025-10-081-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | There was a comparison chain in `tor_proto::util::poll_all::test::ResolveAfter::poll` which was causing a clippy warning. The lint in question, `clippy::comparison_chain`, was a `clippy::style` lint in 1.85.1 and got moved to `clippy::pedantic` in 1.87.0 (see [rust-clippy!14219]). Since some of us (like me) develop on MSRV, I'm fixing this lint now. Gabi didn't have any strong opinions on whether I did it like this or with an `allow` attribute, so I decided this was better since it means we don't have to come back later just to remove the `allow`. It should be noted that using a match like this can sometimes be a performance regression (see [rust-clippy#5354] and [rust-clippy!6390]). I would expect in this case the effect will be very little, if any, but if tests in `tor_proto::util::poll_all::test` start taking much longer and having an impact on CI or something, this could be why. [rust-clippy!14219]: https://github.com/rust-lang/rust-clippy/pull/14219 [rust-clippy#5354]: https://github.com/rust-lang/rust-clippy/issues/5354 [rust-clippy!6390]: https://github.com/rust-lang/rust-clippy/pull/6390 Signed-off-by: hashcatHitman <[email protected]>
* proto: Implement channel padding with maybenot padders.Nick Mathewson2025-10-021-5/+0
| | | | With this commit we now actually generate padding when we're told to.
* proto: start implementing logic for padding actions.Nick Mathewson2025-10-022-1/+6
|
* Add a blocker to channel outbound sink.Nick Mathewson2025-10-021-0/+1
|
* padding: Remove post-queue blocker.Nick Mathewson2025-09-301-1/+5
| | | | | | | We no longer want to _ever_ block non-DATA cells, per discussion in circuit-padding.md. Closes #2190.
* proto: Document exactly how PollAll polls its futures.Gabriela Moldovan2025-09-251-1/+11
|
* proto: Resolve a couple of clippy warnings in the tests.Gabriela Moldovan2025-09-251-2/+2
|
* proto: Add PollAll helper for driving futures in lockstep.Gabriela Moldovan2025-09-251-0/+195
|
* Merge branch 'expire-halfstream-cbt' into 'main'gabi-2502025-09-241-0/+17
|\ | | | | | | | | | | | | proto: Remove half-streams when they expire. Closes #264 See merge request tpo/core/arti!3267
| * proto: Add new error type for cells received on non-existent streams.Gabriela Moldovan2025-09-221-0/+17
| | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3267#note_3261239
* | Merge branch 'migrate-to-waker-noop' into 'main'Jim Newsome2025-09-221-6/+4
|\ \ | | | | | | | | | | | | Migrate to waker noop See merge request tpo/core/arti!3250
| * | Migrate to waker noopdisha2025-09-221-6/+4
| | |
* | | counting_policy: fix a doc link.Nick Mathewson2025-09-171-1/+1
| | |
* | | proto::util::sink_blocker: Narrow dead_code warning exception.Nick Mathewson2025-09-172-17/+6
| |/ |/|
* | Merge branch 'maybenot-validate-padding' into 'main'Nick Mathewson2025-09-151-1/+20
|\ \ | | | | | | | | | | | | Validate incoming padding, and permit it when it is valid. See merge request tpo/core/arti!3241
| * | proto: Use a new error type for excess padding.Nick Mathewson2025-09-151-1/+20
| |/
* / proto: Only replace padding when the target will see it.Nick Mathewson2025-09-101-0/+8
|/ | | | | | | | | | | Previously we would replace padding with any cell that was already in the queue. But that doesn't make sense: If we have a cell queued for hop 1, then we shouldn't use it as padding for hop 2, since hop 2 will never see it! Instead, we look at the target hops for the already queued cells. Ref: - https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3225/diffs?commit_id=3998e0559fbcc06f8ea88968051cebca71489a52
* Two grammar/typo fixes from @gabi-250Nick Mathewson2025-09-091-1/+1
|
* proto: add SometimesUnboundedSink::as_inner_mut.Nick Mathewson2025-09-091-0/+11
| | | | Include suitable dire warnings about actually using it.
* SinkBlocker: Add a comment in poll_flushNick Mathewson2025-09-081-0/+2
|
* SometimesUnboundedSink: clarifying documentation.Nick Mathewson2025-09-081-0/+7
| | | | | Explain how exactly its "you-must-poll-me" behavior relates to the rest of the Sink ecosystem.
* proto: Make CountingPolicy constructors pub(crate).Nick Mathewson2025-09-081-3/+3
|
* proto: Define a new composable SinkBlocker type.Nick Mathewson2025-09-043-0/+540
| | | | | | | | This type wraps a futures::Sink, and allows it to be temporarily blocked and unblocked. I'm going to use this to implement padding-based circuit blocking, according to the designs in !3225.
* proto: Make the OutboundClientHandshake use new cell handlerDavid Goulet2025-08-201-9/+0
| | | | | | | | | | | | | | | | | Use the ChannelFrame<> for the entirety of the outbound client handshake that is the ClientInitiator channel type. With this change, the codec.rs code is not needed anymore along its CodecError as well which has been normalized onto the crate::Error instead in order to simplify error handling and avoid duplication of error types. Unit tests have been modified to reflect this change of what can be done with a channel frame. Also renamed to focus on client behavior. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* proto: Implement a From<std::io::Error> for ErrorDavid Goulet2025-08-201-0/+6
| | | | | | | | | To be able to return a crate::Error from the Decoded/Encoder trait, it needs to implement this conversion. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* clippy: fix `clippy::duplicated_attributes` warningsSteven Engler2025-08-111-1/+0
| | | | | | | | | | ```text warning: duplicated attribute --> crates/tor-hsservice/src/timeout_track.rs:630:14 | 630 | #![allow(clippy::needless_pass_by_value)] // TODO hoist into standard lint block | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-078-19/+21
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.