summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/circuit.rs
Commit message (Collapse)AuthorAgeFilesLines
* proto: Make PathEntry::Virtual feature-conditional.Nick Mathewson2023-05-231-0/+2
| | | | | This fixes a warning when building tor-proto without the `rpc-common` feature.
* proto: Explain "virtual" hops better.Nick Mathewson2023-05-181-0/+4
| | | | Based on text from @diziet
* proto: Allow circuit Paths to represent virtual hops.Nick Mathewson2023-05-181-3/+21
| | | | | 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-2/+17
| | | | | | | 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-0/+2
| | | | | This is fairly straightforward, thanks to our existing design work on this code.
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-17/+21
| | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* Change CircTarget::linkspecs() to return an encoded list.Nick Mathewson2023-05-101-4/+6
| | | | | | | | 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: Be explicit about an into().Nick Mathewson2023-04-121-1/+1
| | | | | | | This is a workaround for an issue that I'm about to encounter somewhere in our pile of dependencies as I add arti-rpcserver, and somehow make serde_json visible in this test code thereby, making the PartialEq method resolution ambiguous.
* Add an experimental circuit accessor to DataStream.Nick Mathewson2023-03-231-0/+6
| | | | Closes #784.
* tor-proto: Split off send-control-msg featureIan Jackson2023-03-231-4/+4
|
* tor-proto: document deep-copy in ClientCirc::path()Nick Mathewson2023-03-221-0/+4
|
* proto: Stabilize ClientCirc::n_hops.Nick Mathewson2023-03-221-1/+6
|
* tor-proto: Document limitation on send_control_messageNick Mathewson2023-03-081-0/+7
|
* tor-proto: Make send_control_message wait for the reactor.Nick Mathewson2023-03-081-2/+7
| | | | | 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-081-7/+8
|
* tor-proto: Implement functionality to send a message and accept repliesNick Mathewson2023-03-081-47/+44
| | | | | | | | | | | 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: Give Path a method to access final hop num.Nick Mathewson2023-03-081-10/+6
|
* tor-proto: Give circ Reactor a constructor, and make its fields private.Nick Mathewson2023-03-081-18/+2
|
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-281-3/+3
| | | | Fixes #756
* Use CmdChecker in our stream handling code.Nick Mathewson2023-02-171-3/+12
| | | | | | | | | | 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: note implications for future HS workNick Mathewson2023-02-151-0/+10
|
* tor-proto: defer meta-cell parsing to the last moment.Nick Mathewson2023-02-151-3/+4
|
* tor-cell: Refactor relay cells to copy much lessNick Mathewson2023-02-151-5/+4
| | | | | | | | | | | | | 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.
* Rename OpenClientChan{Msg,Cell} => OpenChan{Msg,Cell}S2CNick Mathewson2023-02-091-3/+3
|
* tor-proto: Do not parse forbidden commands on inbound cells.Nick Mathewson2023-02-091-2/+3
| | | | | | | | | | 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-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-071-23/+26
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-071-18/+18
|
* tor-cell: Change all variants of RelayMsg to have a body.Nick Mathewson2023-02-071-4/+5
| | | | | Previously, there were some unit variants, but that makes things quite awkward for #525.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* tor-proto: comment fixes and more TODO hsNick Mathewson2023-01-241-0/+12
|
* tor-proto: Draft API to handle incoming BEGIN requests.Nick Mathewson2023-01-171-0/+26
| | | | Onion services (and later, exits and caches) will need this.
* tor-proto: Expose support for doing onion service handshakesNick Mathewson2023-01-171-0/+28
| | | | | | 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: Draft APIs for handling control messagesNick Mathewson2023-01-171-0/+52
| | | | | We will need these for onion services, to send and receive messages of types not handled directly by the tor-proto crate.
* tor-proto: CreateFastWrap::decode_chanmsg: Do not report handshakeIan Jackson2023-01-061-2/+2
| | | | | The debug impl prints the handshake challenge, which we should probably treat as sensitive.
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+8
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body()Neel Chauhan2022-12-181-2/+2
|/
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-5/+12
| | | | These are now builders.
* Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-021-1/+1
| | | | | | | | | | | | | | We want the set of identities supported by a relay to be extensible in the future with minimal fuss; we'd also like to make working with these ID sets more convenient. To handle that, this commit adds a new trait for "Something that has the same IDs as a relay" and a new object for "an owned representation of a relay's IDs." This commit introduces a similar trait for "Something with a list of SocketAddr, like a relay has." There's no owned equivelent for that, since Vec<SocketAddr> is already a thing. Closes #428.
* Remove some testing-only reimplementations of OwnedChanTarget.Nick Mathewson2022-08-021-35/+8
| | | | These predate OwnedChanTarget, and are no longer needed.
* tor-proto: Split CellErr based on activity.Nick Mathewson2022-06-231-1/+2
| | | | | | 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-1/+1
| | | | | This avoids adding additional information for now; that will come on the next commits.
* try to differentiate transient from nontransient errortrinity-1686a2022-06-081-7/+4
|
* Merge branch 'sleep' into 'main'Ian Jackson2022-06-081-1/+1
|\ | | | | | | | | Plumb a SleepProvider (now Clone + ....) into Channel See merge request tpo/core/arti!569
| * Plumb a SleepProvider into the channel reactorIan Jackson2022-06-081-1/+1
| | | | | | | | | | The channel reactor is going to want to be able to sleep so that it can do padding, so it needs a SleepProvider.
* | Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-4/+4
|/ | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* Add a channel accessor to ClientCirc.Nick Mathewson2022-05-111-1/+20
| | | | | I need this so that I can expose the skew time for the directory that a circuit will use, when I only have the circuit.
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+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/+25
| | | | Closes #415