aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-proto: Add method for getting the HopNum of the last hop.Gabriela Moldovan2023-08-041-0/+14
| |
* | tor-proto: Make HopNum public.Gabriela Moldovan2023-08-042-1/+2
|/ | | | | | `HopNum` will be used in `ClientCirc`'s public API when we refactor `ClientCirc::start_conversation_last_hop` to use the provided hop rather than always using the last one.
* tor-proto: Bump test sleep to 200ms for now.Gabriela Moldovan2023-08-031-5/+10
| | | | | | | | | | | | This `sleep` is to give the reactor task a chance to process the `AwaitIncomingStream` message. With an 100ms, this test sometimes fails because for some reason the reactor doesn't get a chance to process the `AwaitIncomingStream` control command before the BEGIN cell from the client task is received. This bumps the sleep time to 200ms for now (TODO: follow-up with an MR with a less flaky approach). While trying to repro the issue, I found another corner case for which I've added a TODO HSS.
* tor-proto: Handle new BEGIN cells for rejected stream.Gabriela Moldovan2023-08-032-0/+101
| | | | | | | | | This updates the reactor to call the incoming stream handler even for streams for which we have a stream map entry of `EndSent`. If we've sent an END message for a stream but have not yet received an END message back from the other party, but we later receive a BEGIN from them, it is safe to assume we cam remove the stream from the stream map and handle the new incoming stream request.
* tor-proto: Clarify what we mean by "stream" in allow_stream_requests.Gabriela Moldovan2023-08-031-3/+3
|
* tor-proto: Add note about making hop_num optional.Gabriela Moldovan2023-08-031-0/+7
|
* tor-proto: Add a TODO about checking if a hop is allowed to create streams.Gabriela Moldovan2023-08-031-0/+3
|
* tor-proto: Remove unnecessary else-branch.Gabriela Moldovan2023-08-031-38/+38
| | | | | We return early if `message_closes_stream == true`, so we can get rid of the `else` to remove one level of indentation.
* tor-proto: Update the stream map if we get an END message.Gabriela Moldovan2023-08-031-1/+5
| | | | | This handles the previously not handled `message_closes_stream == true` case.
* tor-proto: Add TODO regarding allow_stream_requests corner case.Gabriela Moldovan2023-08-031-0/+24
|
* tor-proto: Remove outdated comments.Gabriela Moldovan2023-08-031-3/+0
|
* tor-proto: Add a test for allow_stream_requests.Gabriela Moldovan2023-08-031-0/+70
|
* tor-proto: Implement allow_stream_requests.Gabriela Moldovan2023-08-031-7/+49
|
* tor-proto: Handle RELAY_BEGIN cells if we have an incoming req handler.Gabriela Moldovan2023-08-031-0/+84
|
* tor-proto: Implement IncomingStream::{accept_data, request, reject}.Gabriela Moldovan2023-08-031-6/+32
|
* tor-proto: Add StreamTarget function for sending CtrlMsg::CloseStream .Gabriela Moldovan2023-08-031-0/+46
| | | | This will be used by `IncomingStream` to implement `reject()`.
* tor-proto: Add reactor control commands for accepting/closing incoming streams.Gabriela Moldovan2023-08-031-4/+62
| | | | | | | | | This adds a new `AwaitIncomingStream` control message for registering an interest in an incoming stream. This also adds a `ClosePendingStream` control message for explicitly closing a stream with a given END message (needed for implementing `IncomingStream::reject`).
* tor-proto: Add types for sharing stream request info with the reactor.Gabriela Moldovan2023-08-031-0/+49
|
* tor-proto: Add a helper for adding a stream entry with a specific stream ID.Gabriela Moldovan2023-08-032-2/+47
| | | | | | | | | This adds a new `add_ent_with_id` function for adding a new entry to the `StreamMap`. The existing `add_ent` function auto-generates a new stream ID, which is not good if we're a hidden service, as stream IDs are supposed to be chosen by the OP (client). When accepting a new stream, services, exit relays, and dir auths need to use the stream ID received in the BEGIN cell (instead of generating a new stream ID).
* tor-proto: Remove extraneous space.Gabriela Moldovan2023-08-032-2/+2
|
* tor-proto: Add constructors for pre-connected DataStreams.Gabriela Moldovan2023-08-031-2/+41
| | | | | | | | | When accepting a new stream, hidden services, exit relays and dirauths don't wait for a `CONNECTED` cell from the initiator. This commit adds constructors for building `DataStream`s and `DataCmdChecker`s that can immediately receive data cells (and don't expect to receive `CONNECTED` cells at all).
* tor-proto: Add a constructor for IncomingStream.Gabriela Moldovan2023-08-031-0/+13
|
* tor-proto: Add imports for commonly used types.Gabriela Moldovan2023-08-031-4/+4
|
* tor-proto: Add IncomingCmdChecker for IncomingStream.Gabriela Moldovan2023-08-032-2/+62
|
* tor-proto: Rename create_firsthop() to wait_for_create().Gabriela Moldovan2023-07-271-2/+2
|
* tor-proto: Update handle_control docs.Gabriela Moldovan2023-07-261-1/+1
|
* tor-proto: Add functions for handling Shutdown and AddFakeHop messages.Gabriela Moldovan2023-07-261-42/+37
| | | | | This helps reduce code duplication, as `CtrlMsg::Shutdown` and `CtrlMsg::AddFakeHop` are now handled in multiple places.
* tor-proto: Extract first-hop creation to a separate function.Gabriela Moldovan2023-07-261-37/+11
| | | | | | I think it's safe to handle `ChanMsg::Create` separately, because there's nothing for the reactor to do until the first hop of the circuit is created (so blocking on this _should_ be alright).
* tor-proto: Create a function for handling the initial CREATE cell.Gabriela Moldovan2023-07-261-1/+89
| | | | | | This logic from `create_firsthop()` was extracted (copied) from `Reactor::run_once()`. A future commit will update `Reactor::run_once()` to use `create_firsthop()`.
* tor-circmgr: Add two possibly-needed docsrs annotationsIan Jackson2023-07-122-0/+2
| | | | | I don't know if these are needed because the rules are not documented afaict. But it seems like probably they ought to be there?
* tor-proto: Conversation: drop two otiose cfg(feature)Ian Jackson2023-07-122-2/+0
| | | | These fns are in a feature-gated impls on feature-gated structs.
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-1117-0/+17
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396
| * Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-1017-0/+17
| |
* | Merge branch 'conversation' into 'main'Alexander Færøy2023-07-103-113/+203
|\ \ | |/ |/| | | | | Overhaul send_control_message See merge request tpo/core/arti!1367
| * tor-proto: run rustfmtIan Jackson2023-06-303-8/+18
| |
| * tor-proto conversations: Drop a TODOIan Jackson2023-06-301-1/+0
| | | | | | | | I think this name is fine.
| * tor-proto conversation API: Provide ConversationInHandlerIan Jackson2023-06-303-6/+58
| |
| * tor-proto circuit: Plumb async Context throughIan Jackson2023-06-302-3/+8
| | | | | | | | handle_msg is going to want this in a moment.
| * tor-proto conversation API: Soften a warningIan Jackson2023-06-301-1/+4
| | | | | | | | | | If the circuit is just being used by us (which is likely, if we're using this API) then the only reactor we're blocking is our own.
| * tor-proto conversation API: Implement ConversationIan Jackson2023-06-301-89/+98
| | | | | | | | | | Now, after you call start_conversation_last_hop, you can send more messages if you like.
| * tor-proto: Make the handler in SendMsgAndInstallHandler optionalIan Jackson2023-06-302-3/+10
| | | | | | | | | | We're going to want to do almost-the-same thing but without installing a new handler.
| * tor-proto conversation API: Return a ConversationIan Jackson2023-06-301-8/+15
| | | | | | | | | | This is just a placeholder for now, but it'll be a thing you can send more messages with.
| * tor-proto conversation API: Rename to start_conversation_last_hopIan Jackson2023-06-302-9/+9
| | | | | | | | Was send_control_message.
| * tor-proto conversation API: Make starting message optionalIan Jackson2023-06-302-5/+7
| | | | | | | | | | We're going to let people start a conversation and either expect to receive first, or send messages ad-hoc later.
| * tor-proto conversation API: Rename to ConversationFinishedIan Jackson2023-06-301-7/+3
| | | | | | | | | | | | Was UninstallHandler. We are going to talk more about conversations and less about handlers (although, the fact of there being a handler will still be visible).
| * tor-proto circuit: Make reactor::run_once modulae-privateIan Jackson2023-06-301-1/+1
| | | | | | | | Nothing else wants this and having it pub(super) is confusing.
* | Merge branch 'allow_missing_panics' into 'main'Ian Jackson2023-07-073-8/+2
|\ \ | | | | | | | | | | | | | | | | | | add_warning: Tolerate clippy::missing_panics_doc Closes #950 See merge request tpo/core/arti!1380
| * | Remove explicit allows for missing_panics_docs.Nick Mathewson2023-07-062-7/+2
| | | | | | | | | | | | These are no longer needed.
| * | Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| |/ | | | | | | Closes #950.
* / Avoid matches!(x, None), matches!(x, Ok(_))Nick Mathewson2023-07-061-2/+2
|/ | | | This appeases clippy-nightly.