summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/circuit
Commit message (Collapse)AuthorAgeFilesLines
* proto: Make PathEntry::Virtual feature-conditional.Nick Mathewson2023-05-231-0/+1
| | | | | This fixes a warning when building tor-proto without the `rpc-common` feature.
* Merge branch 'virtual_hop' into 'main'Nick Mathewson2023-05-183-9/+108
|\ | | | | | | | | | | | | tor-proto: Add support for extending circuits through virtual hops. Closes #726 See merge request tpo/core/arti!1191
| * proto: Allow circuit Paths to represent virtual hops.Nick Mathewson2023-05-182-11/+36
| | | | | | | | | | Sadly, this adds a few more `TODO HS` entries, but I think we can clean them up later after a bit of discussion.
| * proto: Implement Circuit::extend_virtual.Nick Mathewson2023-05-181-0/+42
| | | | | | | | | | | | | | There are a few new TODO hs comments, though, and an XXXX I'll need to fix up in the next commit. Implements #726.
| * tor-proto: Code to construct crypto layers for virtual hops.Nick Mathewson2023-05-181-1/+33
| | | | | | | | | | This is fairly straightforward, thanks to our existing design work on this code.
* | tor-guardmgr, tor-proto: minor logging tweakseta2023-05-181-2/+2
|/ | | | | | | | - We make the tor-guardmgr "We have found that {} is usable" line include the word "guard", otherwise it doesn't appear very useful to a user in safe logging mode, since the guard gets replaced with [scrubbed]. - The "Actually got an end cell..." message is downgraded to DEBUG.
* Change CircTarget::linkspecs() to return an encoded list.Nick Mathewson2023-05-101-3/+3
| | | | | | | | If we didn't do this, we would need to transfrom `EncodedLinkSpec`s into a `LinkSpec::Unrecognized`, which is not semantically right. What's more, every user of this API wants to consume encoded link specifiers, so encoding them early saves a little effort.
* tor-proto: Feature-conditionalise some enum variantsIan Jackson2023-03-231-0/+6
| | | | This avoids some dead code warnings when building without send-control-msg.
* tor-proto: Split off send-control-msg featureIan Jackson2023-03-231-1/+1
|
* tor-proto: Say "control message" a little more consistentlyNick Mathewson2023-03-081-1/+2
| | | | | | | (I found "user request" in one place, and fixed that. I am not currently going to try to unify "control message" and "meta message" since both terms are misleading and we already have TODOs to try to merge them into a third better term.)
* tor-proto: Make send_control_message wait for the reactor.Nick Mathewson2023-03-081-3/+15
| | | | | This way we don't need to worry about race conditions that happen if the caller thinks that the handler is installed before it really is.
* tor-proto: Have send_control_message install a handler, not return a streamNick Mathewson2023-03-082-91/+65
|
* tor-proto: Implement functionality to send a message and accept repliesNick Mathewson2023-03-082-5/+115
| | | | | | | | | | | This new function combines "sending a message" and "accepting replies in a stream" into a single call, so that there is no gap between when the message is sent and the replies are available. There are a number of compromises here, in order to avoid API proliferation. I've tried to contain them as best I can. See comments for additional design discussion.
* tor-proto: Change semantics of MetaCellHandlerNick Mathewson2023-03-081-72/+126
| | | | | | | | | | | | | | | | | Now, the MetaCellHandler is responsible for consuming the messages it gets, and reporting status to whatever task is waiting for a status message. Additionally, the MetaCellHandler can decide to remain installed or shut down the circuit after a successful message. (Previously, it could only uninstall itself on success and kill the circuit on failure.) These changes will enable MetaCellHandlers to be used as the basis for handling more kinds of message. (There is some moved and reformatted code here; you may want to review it with `git {diff or show} --color-moved -b`.)
* tor-proto: Give Path a method to access final hop num.Nick Mathewson2023-03-081-0/+10
|
* tor-proto: Give circ Reactor a constructor, and make its fields private.Nick Mathewson2023-03-081-12/+46
|
* proto: Tweak documentation and names around CmdChecker.Nick Mathewson2023-02-272-1/+17
|
* tor-proto: Rename end_received.Nick Mathewson2023-02-172-8/+9
| | | | It can now indicate _any_ cell that means we can forget about a stream.
* Use CmdChecker in our stream handling code.Nick Mathewson2023-02-173-93/+80
| | | | | | | | | | This change makes sure that open streams and half-closed streams have the same stream-type-dependent state machines with respect to which cells are acceptable. Fixes #774. Fixes #769.
* tor-proto: Add a TODO about simplifying a common pattern.Nick Mathewson2023-02-151-0/+8
|
* tor-proto: Push stream message parsing into the stream objects.Nick Mathewson2023-02-153-20/+21
| | | | | This closes #525, and ensures, at last, that we don't parse any message that we wouldn't accept.
* tor-proto: Defer parsing of messages send to half-closed streamsNick Mathewson2023-02-153-42/+94
| | | | | | This includes a partial solution for #769, but also turned up another bug (#774) while I was working on it. I'll close them both once I have a real solution.
* tor-proto: stop reactor (and kill circuit) if meta handler failsNick Mathewson2023-02-151-4/+7
| | | | | | | If the meta handler reports an error, then the circuit has violated its protocol, and needs to be shut down. Fixes #773.
* tor-proto: defer meta-cell parsing to the last moment.Nick Mathewson2023-02-151-33/+23
|
* tor-proto: Use UnparsedRelayCell to start deferring cell processing.Nick Mathewson2023-02-152-22/+43
| | | | | In general, we want to avoid parsing these cells until we are fairly sure that they are something we would accept.
* tor-cell: Refactor relay cells to copy much lessNick Mathewson2023-02-151-2/+2
| | | | | | | | | | | | | We now manipulate raw relay cell bodies as (an alias for) `Box<[u8;509]>` rather than as (an alias for) `[u8;509]`. This enables us to do much less copying. It will become more important soon, as we defer parsing relay cell bodies even longer. Related to #7. We also use SliceWriter to avoid allocating a Vec<> for every relay message we want to encode, and instead encode directly into the cell.
* tor-cell: Make RelayEarly a separate type.Nick Mathewson2023-02-092-4/+4
| | | | This allows us to remove a shenanigan from `restricted_msg!{}`.
* tor-cell: Have restrict_msg add conversion functions.Nick Mathewson2023-02-091-2/+2
| | | | | | | | | | | | | | | | Every FooMsg type now implements Into<AnyFooMsg>, and TryFrom<FooMsg>. Additionally, it now implements From<X> for every distinct type that it supports. This last part lets us discard a bunch of code. Unfortunately, I needed some downright hackish trickery in order to get these macros to avoid generating `From<AnyFooMsg> for AnyFooMsg` and conflicting with the blanket implementation. The trickery to deal with RelayEarly and Relay being the same type was not necessarily worth it; I will be separating them and removing said trickery in the next commit.
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-074-48/+54
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-072-27/+27
|
* tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass.Nick Mathewson2023-02-072-2/+2
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-072-2/+5
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-274-0/+4
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Merge branch 'sensitive' into 'main'eta2023-01-261-3/+4
|\ | | | | | | | | tor-proto: Mark stream ids in errors as sensitive See merge request tpo/core/arti!986
| * tor-proto: Mark stream ids in errors as sensitiveIan Jackson2023-01-241-3/+4
| | | | | | | | Pursuant to #556
* | tor-proto: comment fixes and more TODO hsNick Mathewson2023-01-241-2/+6
| |
* | tor-proto: Expose support for doing onion service handshakesNick Mathewson2023-01-171-0/+33
|/ | | | | | This is a little tricky, but I think that we're not actually exposing too much here. I expect we'll need to tweak this stuff between now and our final version.
* tor-proto: impl Display for CreateResponseIan Jackson2023-01-061-0/+12
| | | | Don't print the handshake value, but do print the display reason.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-124-0/+32
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-2/+11
| | | | These are now builders.
* add feature annotation not added by doc_auto_cfgtrinity-1686a2022-08-241-0/+1
|
* tor-proto: Make "testing" feature that exports some thingsIan Jackson2022-08-161-2/+5
| | | | | We are going to want this for through-the-layers padding control testing.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-16/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, each individual identity type becomes optional. The functions that expose them unconditionally are now in a "legacy" trait that only some downstream types are expected to implement. There are new convenience APIs in HasRelayIds: * to return Option<&keytype>, * to see if one identity-set contains another. This commit will break several downstream crates! For the reviewer's convenience, I will put the fixes for those crates into a series of squash! commits on this one. tor-netdir ---------- Revise tor-netdir to accept optional identities. This required some caveats and workarounds about the cases where we have to deal with a key type that the tor-netdir code does not currently recognize at all. If we start to add more identity types in the future, we may well want more internal indices in this code. tor-proto --------- In order to make tor-proto support optional identities, there were fewer changes than I thought. Some "check" functions needed to start looking at "all the ids we want" rather than at "the two known IDs"; they also needed to accommodate that case where we don't have an ID that we demand. This change will also help with bridges, since we want to be able to connect to a bridge without knowing all of its IDs up front. The protocol currently _requires_ the two current ID types in some places. To deal with that, I added a new `MissingId` error. I also removed a couple of unconditional identity accessors for chanmgr; code should use `target().identity(...)` instead. tor-chanmgr ----------- This is an incomplete conversion: it does not at all handle channel targets without Ed25519 identities yet. It still uses those identities to index its internal map from identity to channel; but it gives a new `MissingId` error type if it's given a channel target that doesn't have one. We'll want to revise the map type again down the road when we implement bridges, but I'd rather not step on the channel-padding work in progress right now. tor-guardmgr ------------ This change is mostly a matter of constructing owned identity types more sensibly, rather than unwrapping them directly. There are some places marked with TODOs where we still depend on particular identity types, because of how the directory protocol works. This will need revisiting when we add bridge support here. tor-circmgr ----------- These changes are just relatively simple API changes in the tests.
* tor-proto: split and elaborate tor_bytes::Error instancesNick Mathewson2022-06-231-1/+2
| | | | | | | | | Some of these were for decoding particular objects (we now say what kind of objects), and some were unrelated tor_cert errors that for some reason we had shoved into a tor_bytes::Error. There is now a separate tor_cert::CertError type, independent from tor_cert's use of `tor_bytes::Error` for parsing errors.
* tor-proto: Split CellErr based on activity.Nick Mathewson2022-06-231-1/+4
| | | | | | Failing to encode is fundamentally different from failing to decode. We now treat those separately, and describe _what_ we failed to encode or decode.
* tor-proto: clean up error names and messagesNick Mathewson2022-06-231-4/+4
| | | | | This avoids adding additional information for now; that will come on the next commits.
* tor-proto: err: Provide ChannelClosed as a separate unit errorIan Jackson2022-06-211-3/+3
|
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-252-4/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* Define accessors for circuit hops.Nick Mathewson2022-03-171-0/+14
| | | | Closes #415
* tor-proto: Remember peer information in circuit and channelNick Mathewson2022-03-172-12/+33
| | | | | | | | | Each channel now remembers an OwnedChanTarget. Each circuit now remembers a vector of OwnedChanTarget to represent the path that it was constructed for. Part of #415.