summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/circuit.rs
Commit message (Collapse)AuthorAgeFilesLines
* Make filter conditional, to fix build with hs-service disabled.Nick Mathewson2024-03-261-0/+3
|
* Rename the old IncomingStreamRequestContext to StreamReqInfo.Nick Mathewson2024-03-261-2/+2
| | | | (Doing this to prevent us having two structs with the same name.)
* Add an IncomingStreamRequestFilter to check early propertiesNick Mathewson2024-03-261-1/+24
| | | | | | | Based on designs in #1124. Note that there is a TODO here about a hack I had to do to appease the borrow checker.
* We now need circuit::handshake to exist unconditionally.Nick Mathewson2024-03-261-0/+4
|
* Refactor the logic for constructing crypt layers.Nick Mathewson2024-03-261-13/+4
| | | | | | | | | | | The key insights here are: - That relay cell format and crypto protocols aren't orthogonal: Once we have GCO, it will require V1. - That we only need the actual functions for layer construction to be generic; we don't need to proliferate generic parameters everywhere. - That the circuit::handshake module already does most of what we want.
* Add and use RelayCellFormatTraitJim Newsome2024-03-201-2/+10
| | | | | | This lets us paramaterize types and functions by a particular relay cell format. We use this e.g. to statically parameterize the cell crypto functions, thereby removing some run-time branching in the hot path.
* Propagate RelayCellFormat selection up to where format decisions will be madeJim Newsome2024-03-201-1/+9
|
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* relay-cell: Update relay cell decoding API for prop340Jim Newsome2024-03-121-7/+25
| | | | | | | | | | | Prop 340: https://spec.torproject.org/proposals/340-packed-and-fragmented.html This updates the decoding API to support multiple versions of the relay cell encoding, including the new encoding proposed in prop340 that supports relay message packing and fragmentation. This commit doesn't actually add support for that new encoding yet.
* tor-proto: Add function for peeking at pending circ unique ID.Gabriela Moldovan2024-02-271-0/+5
| | | | | | | | | `tor_circmgr::Error::Protocol` will soon include an optional `UniqId`. Since `Protocol` errors can be caused by pending circuits, we need to be able to peek at their `UniqId`. Part of #1297
* Merge branch 'send_incoming_request_failures' into 'main'gabi-2502024-01-171-9/+8
|\ | | | | | | | | | | | | Several clean-ups around failures in incoming stream request handlers. Closes #1190, #1189, and #1188 See merge request tpo/core/arti!1892
| * Give an error on duplicate call to allow_stream_requests.Nick Mathewson2024-01-171-6/+0
| | | | | | | | Closes #1190
| * proto: Close circuit _intentionally_ when Request Sink is dropped.Nick Mathewson2024-01-171-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, it might be better to just un-register the IncomingStreamRequestHandler when the Receiver for the stream requests is dropped. However, there are two reasons not to do so: 1. It's tricky. We never actually poll on the corresponding Sink, so there isn't a place where the Reactor would expect to get a prompt notification of closure. We only find out that the Receiver has been dropped when an attempt to send on the Sink returns an `is_disconnected` error. 2. It's unnecessary. In the Tor protocols, once we have decided to accept incoming stream requests on a circuit, we want to continue to do so until one of the parties closes the circuit. I've documented this in several comments, in case whe want to get fancier in the future. Closes #1188.
| * proto: Send END when buffer of IncomingRequests is fullNick Mathewson2024-01-171-2/+0
| | | | | | | | Closes #1189.
* | Remove TODO for #1191Nick Mathewson2024-01-171-3/+0
|/ | | | | | The bug described here was already fixed as #1065 via !1681. Closes #1191.
* proto: Convert a TODO HSS to ticket #1191Nick Mathewson2024-01-101-1/+1
|
* Downgrade and convert TODO HSSs to #1190.Nick Mathewson2024-01-101-2/+2
| | | | | | | | | These are about making allow_incoming_streams give an error if a handler is already installed. I'm calling these non-MUST, since they don't affect the actual API here, and we already have comments telling you not to do that. We can add them later.
* Convert a TODO HSS about excessive BEGINs to #1189.Nick Mathewson2024-01-101-1/+2
|
* proto: Downgrade TODO HSS about HopNum in IncomingStreamRequestCommentNick Mathewson2024-01-101-0/+8
| | | | | | | These comments are about internal representations and future extensions. Also, add a fail-safe check to make sure that hop_num consistency is enforced.
* Rename {Any}RelayCell to {Any}RelayMsgOuterNick Mathewson2023-12-141-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is pure renaming, done automatically with rust-analyzer. Comment fixes and other cleanups will be in the subsequent commits. We're doing this renaming because we need a name for the combination of a `RelayMsg` and an `Option<StreamId>` that we use when we have a `RelayMsg` we intend to route to a given stream or circuit internally. Previously we called this a `RelayCell`, but that name was already somewhat inaccurate, and will become _very_ inaccurate with the arrival of prop340, which breaksthe 1:1 relationship between relay cells and relay messages. (If we didn't do this renaming now, we'd soon be making the relationship between `UnparsedRelayCell`and `RelayCell` many-to-many, which would be ridiculous and confusing.) The `RelayMsgOuter` name is a placeholder: We expect that we'll want to rename this type, and may also want to rename `RelayMsg`, and unify our vocabulary in other areas too. But such a renaming will have to wait for a larger discussion affecting the specifications, so that we can use the same vocabulary everywhere.
* Test extend_ntor_v3Jim Newsome2023-11-271-10/+33
|
* Parameterize circuit-extension test by handshake typeJim Newsome2023-11-271-55/+68
|
* Add `ClientCirc::extend_ntor_v3`Jim Newsome2023-11-271-0/+38
|
* Circuit reactor: test ntor-v3 "create"Jim Newsome2023-11-271-43/+101
|
* Add PendingClientCirc::create_firsthop_ntor_v3Jim Newsome2023-11-271-0/+43
|
* Merge remote-tracking branch 'public/hs_begin'Nick Mathewson2023-11-161-0/+1
|\
| * hsrproxy: Send back DONE reasons.Nick Mathewson2023-10-231-0/+1
| | | | | | | | | | This is in keeping with the behavior of C tor, and of torspec!179.
* | Send less information in onion service BEGIN messagesNick Mathewson2023-11-151-0/+5
| | | | | | | | | | | | | | | | | | While looking for differences, we found that C tor always omits the flags and the hostname from a BEGIN message sent on an onion service circuit. In torspec!179, we specified that behavior. This patch brings arti into conformance. Closes #1077.
* | tor-proto: make ClientHandShake and ServerHandshake generic over aux dataJim Newsome2023-11-151-4/+3
| |
* | ServerHandshake: extend to support ntorv3 extensionsJim Newsome2023-11-151-5/+22
| |
* | Add a caret_int HandshakeType for HTYPE constantsJim Newsome2023-10-261-1/+2
| |
* | Change `CircId` to never be zeroJim Newsome2023-10-251-8/+8
| | | | | | | | | | | | | | | | | | | | 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.
* | Convert StreamId to NonZeroU16Jim Newsome2023-10-251-29/+31
|/
* Fix rustdoc link warnings/errors.Nick Mathewson2023-10-201-1/+1
|
* proto: Revise the behavior of IncomingStream::discard().Nick Mathewson2023-10-191-4/+3
| | | | | | | | | | | | | Because dropping a `StreamTarget` causes the circuit reactor to send an End, the previous do-nothing implementation of `discard()` wasn't sufficient to cause the request to be ignored without sending an End. This commit modifies our "close pending stream" behavior to only optionally send an End message. To avoid confusion, I'm using a new `CloseStreamBehavior` enum rather than an `Option<End>`, since we had previously used `None` in some cases to indicate a default (misc) end message.
* proto: Remove TODOs about panics on double-close.Nick Mathewson2023-10-191-17/+2
| | | | | | | Now that `StreamMap::terminate` no longer panics, and now that it permits the kind of double-call that we allow, we can close #1065. Closes #1065.
* Add comments about another problem with close_pending().Nick Mathewson2023-10-171-0/+7
| | | | See #1065 for more information here.
* proto: Make StreamTarget::close() misuse less likely.Nick Mathewson2023-10-171-2/+5
| | | | | | | | | It turns out that we can make `IncomingStream::reject()` consume self, thus making it impossible to hit the double-close error from outside the `tor-proto` crate. Also, we rename `StreamTarget::close()` to `close_pending()` to better reflect its limited applicability.
* oneshot: Use veneer in tor-protoIan Jackson2023-10-111-1/+2
|
* tor-proto: Make allow_stream_requests() not return a ResultNick Mathewson2023-09-271-4/+4
| | | | | | | The function never yields anything but an `Ok`, so we can simplify its type. (Not a stable feature, so no semver entry needed)
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Use "typos-cli" to fix a bunch of typos.Nick Mathewson2023-08-221-1/+1
|
* proto: fix a comment to refer to circuits, not channels.Nick Mathewson2023-08-221-1/+1
|
* Merge branch 'send_raw_msg' into 'main'Nick Mathewson2023-08-221-0/+27
|\ | | | | | | | | | | | | proto: new ClientCirc::send_raw_msg function. Closes #1010 See merge request tpo/core/arti!1525
| * proto: Add crossrefs between start_conversation and send_raw_msgNick Mathewson2023-08-221-0/+6
| |
| * proto: new ClientCirc::send_raw_msg function.Nick Mathewson2023-08-211-0/+21
| | | | | | | | Closes #1010.
* | Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-1/+1
|/ | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* tor-proto: Add test where an incoming stream comes from an unexpect hop.Gabriela Moldovan2023-08-181-0/+44
| | | | | | | This adds a test that checks if the reactor is shut down if it receives an incoming stream request from an unexpected hop. Part of #1009
* tor-proto: Make ClientCirc::allow_stream_requests take a HopNum.Gabriela Moldovan2023-08-181-4/+18
| | | | | | | | | | For consistency with the other `ClientCirc` APIs, `ClientCirc::allow_stream_requests` now takes a `HopNum` argument. Upon receiving an incoming stream request, the reactor now checks if the request came from the hop specified in `allow_stream_requests` (and if it came from a different hop, the circuit is closed). Part of #1009
* tor-proto: Fix dead_code when building without experimental-apiNick Mathewson2023-08-161-0/+1
|