summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/builder.rs
Commit message (Collapse)AuthorAgeFilesLines
* proto: Remove async for VerifiableChannel::check()David Goulet2026-01-221-16/+15
| | | | Signed-off-by: David Goulet <[email protected]>
* proto: Send relay channel NETINFO in check()David Goulet2026-01-221-15/+19
| | | | | | | | | | Once channel is verified and authenticate if need be, send the NETINFO. We require our advertised IP addresses for this so pass them to launch() as well to the UnverifiedRelayChannel. A cargo fmt change slipped in here, sorry about that. Signed-off-by: David Goulet <[email protected]>
* proto: Make VerifiableChannel::check() asyncDavid Goulet2026-01-221-1/+1
| | | | | | | | | Relay initiator needs to send CERTS and AUTHENTICATE in that function after verifiying the channel. And thus require to be async. Signed-off-by: David Goulet <[email protected]>
* relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-221-1/+2
| | | | | | | | | | | We need the advertised addresses for the NETINFO cell when opening a relay channel. Keep them in the TorRelay object so we can pass them to the ChanMgr channel handler. This will also help with config reload where only the local values in TorRelay will need to be updated. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Get rid of the builder outbound_chan_typeDavid Goulet2026-01-131-8/+23
| | | | | | | | | | | | | | | | | | | Instead, we'll simply use `RelayInitiator` if the identity keys (identities) struct is set. This avoids the problem where someone could call outbound_chan_type() of the ChanMgrConfig and get the wrong channel type if with_identities() is set after. This way, a single call, `with_identities()` is what will define the outbound channel type so no chance of errors. This also removes the cfg_if {} around the builder creation in a much more simplified version. Related to #1599 Signed-off-by: David Goulet <[email protected]>
* chanmgr: Use the new tor-proto channel traits in builderDavid Goulet2026-01-131-170/+55
| | | | | | | Remove code duplication and simplifies the code by using the new VerifiableChannel and FinalizableChannel traits. Signed-off-by: David Goulet <[email protected]>
* proto: Add traits for public channel viewsDavid Goulet2026-01-131-1/+1
| | | | | | | | | | | | | | Add traits that will be returned outside tor-proto allowing us to not expose client and relay specific channels. The goal is for the tor-chanmgr to get those objects implementing those traits and can build and run the reactor without knowing the specific underlying type. This allows us to have less code duplication and less client/relay distinction in the chanmgr. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add a relay channel connect to ChanBuilderDavid Goulet2026-01-131-9/+156
| | | | | | | | | | First, this is not great. Lots of duplicated code but it is a starting point that we can build on top to remove code duplication. Future commit will address this but for now, the client and relay mechanics are implemented. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Rename the connect_no_timeout() to be client specificDavid Goulet2026-01-131-6/+8
| | | | | | | | | | | | | | Heavy refactoring coming up for the ChanBuilder. This renames connect_no_timeout() to be client specific and uses the client channel builder directly instead of the generic one. Previous commit added the outbound ChannelType to the ChanBuilder which means that we'll soon have a relay specific function to connect using the relay channel builder. Refactoring will then happen for shared code in those two functions. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add RelayIdentities to ChanBuilderDavid Goulet2026-01-131-4/+16
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add ChannelType to channel manager configDavid Goulet2026-01-131-2/+7
| | | | | | | | | | This allows us to pass it to the ChanBuilder which will be able to use this type for the outbound channels. For now, we do this trick where if we have relay identities, we always consider that all outbound channels will be RelayInitiator. Signed-off-by: David Goulet <[email protected]>
* chanmgr: Remove KeyMgr from constructorDavid Goulet2026-01-131-7/+2
| | | | | | | We'll rely on a RelayIdentities to pass in the right keys to the ChanMgr instead of the entire KeyMgr. Signed-off-by: David Goulet <[email protected]>
* Merge branch 'relay-bin-4' into 'main'opara2025-11-111-2/+4
|\ | | | | | | | | arti-relay: Add OR port listener task See merge request tpo/core/arti!3396
| * tor-chanmgr: wrap the peer address in `Sensitive`Steven Engler2025-11-051-2/+4
| | | | | | | | | | For incoming connections, wrap the peer address in `Sensitive` as it could be a client.
* | Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
|/ | | | Run maint/add_warning
* all: replace all uses of `futures::task::SpawnExt` with `tor_rtcompat::SpawnExt`Steven Engler2025-11-041-1/+1
|
* Use random_hostname() to pick an (E)SNINeel Chauhan2025-10-201-2/+4
| | | | | | Closes #2210. Edited-by: Nick Mathewson <[email protected]>
* opentelemetry: Add some instrument macros.Wesley Aptekar-Cassels2025-09-241-0/+3
| | | | | I've added these in places that are useful for the debugging that I've been doing.
* chan: Rename channel launch to launch_clientDavid Goulet2025-08-201-1/+1
| | | | Signed-off-by: David Goulet <[email protected]>
* chanmgr: Add KeyMgr to channel builderDavid Goulet2025-08-201-2/+7
| | | | | | | This is so a relay can build authenticated channels. Several keys/cert are required for this that are within the key manager. Signed-off-by: David Goulet <[email protected]>
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-4/+4
| | | | | | | | | | | | | | 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.
* tor-rtmock: allow-Decorate every use of MockSleepProviderIan Jackson2025-03-061-1/+5
| | | | | | | MockSleepProvider and MockSleepRuntime have been declared deprecated by the docs for some time. We're about to mark them `#[deprecated]`. This commit has been split out for clarity of review.
* tor-chanmgr: Add reparameterize_kist to AbstractChannel trait.Gabriela Moldovan2025-01-151-0/+4
| | | | | Needed for the chanmgr to be able to update existing channels with new KIST settings read from the consensus.
* tor-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-031-1/+6
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-chanmgr: Make a memquota::ChannelAcocunt per channelIan Jackson2024-10-031-0/+2
| | | | | This delivers a fresh account per channel to the places where channels are actually made, but doesn't pass them to tor-proto yet.
* tor-chanmgr: Make a memquota::ChannelAcocunt per channel (pre-fmt)Ian Jackson2024-10-031-1/+4
|
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-1/+1
| | | | | | | | | | | | | | (And similarly rename TcpListener to NetStreamListener, along with their TcpStream/TcpListener associated types.) These types are about to become generic over addresses, and therefore shouldn't be named after TCP. Renaming was done mostly with Rust Analyzer, except for some macros that needed to be hand-edited. (I'll revise the comments in the next commit; this one is all about renaming.)
* rtcompat: Remove accept() from TcpListenerNick Mathewson2024-09-241-1/+7
| | | | | | | | | | It's redundant with the incoming() method (which turns the TcpListener into a Stream of connections), and nothing actually used it outside of tests. Removing this method allows us to simplify our TcpListener code a good deal, as can be seen by some of the implementations we removed from our example and testing code.
* tor-chanmgr: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-111-1/+32
| | | | | | | | | The channel manager in the future will need to be able to receive incoming streams. The type of the stream depends on an associated type within `ChannelFactory`, so this commit exposes this associated type through several other types, eventually to the `ChanMgr`. The new methods are behind the experimental "relay" feature flag.
* Merge branch 'chan_arc' into 'main'Nick Mathewson2024-05-281-4/+4
|\ | | | | | | | | Proto: Refactor Channel to always be Arc. See merge request tpo/core/arti!2163
| * proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, Channel was a type that you could Clone that implicitly its state. Now, Channel always appears as an Arc<Channel>. This change has several benefits: * It makes the relationship between Channel struct and the underlying channel more clear. * It enables Channel to participate in the RPC system, where everything has to be an Arc<.> * It enables us to have a Weak<Channel>, if we ever want to. * It will let us move various members out of ChannelDetails. We did this change a while ago with ClientCirc.
* | chanmgr: Delegate to Channel::engage_padding_activities explicitly.Nick Mathewson2024-05-171-1/+1
|/ | | | | | (This isn't a bugfix, but it helps avoid the appearance of a function calling itself. This _would_ become a bug if we imported the wrong trait into scope here.)
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* 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.
* 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.
* Merge branch 'renaming' into 'main'Nick Mathewson2022-11-301-5/+5
|\ | | | | | | | | | | | | Renaming a couple of items for arti 1.1.0 Closes #623 See merge request tpo/core/arti!916
| * Rename TransportHelper => TransportImplHelper.Nick Mathewson2022-11-301-5/+5
| |
* | Downgrade a "TODO pt-client" commentNick Mathewson2022-11-301-1/+3
|/
* Separate BridgeAddr and PtTargetAddrIan Jackson2022-11-301-2/+6
| | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/668#note_2858220 This commit is difficult to split up. The innards of BridgeAddr and PtTargetAddr are still a bit entangled.
* tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuildereta2022-11-281-22/+15
| | | | | | | | | | | | | | | | | | | | | | | | This commit makes the `ChanBuilder` type in `tor-chanmgr` usable by consumers outside of that crate, like the doc comment for `ChannelFactory` says you need to be able to do in order to turn your `TransportHelper` into something useful. As part of doing this, the `event_sender` its constructor takes needed to be dealt with, since it was a crate-internal type that came from inside the `ChanMgr`. Enter `BootstrapReporter`: an opaque wrapper around that sender, now provided as an additional argument to `ChannelFactory::connect_via_transport`. You can now construct a `ChanBuilder` outside this crate, and it'll still be able to report its bootstrap status by unwrapping this new type that's threaded through from the `ChanMgr`. (This was a fair deal of manually threading the type through all the layers in this crate!) Note that you cannot implement bootstrap updating using something that isn't `ChanBuilder` yet due to the type being entirely opaque (but, of course, we can figure out exactly what API the reporter should have later, and add that capability in).
* tor-chanmgr: Invent [Box]ChanSensitive for two error payloadsIan Jackson2022-11-231-1/+1
| | | | | | | | | | | This 1. Makes the errors smaller (in the case of Io's PtTargetAddr; ChannelBuild's addresses are already indirected in a Vec). 2. Redacts (currently, scrubs) the PtTargetAddr and SocketAddr when safe logging is enabled These are the remaining error variants in tor-chanmgr that contain information that should become sensitive as part of bridge support.
* tor-chanmgr: Replace OwnedChanTarget with LoggedChanTarget in errorsIan Jackson2022-11-231-4/+4
| | | | | | | | | This 1. Makes the errors smaller 2. Redacts (currently, scrubs) the chantarget when safe logging is enabled This commit doesn't treat other should-be-sensitive inforemation in errors just yet. That will come in a moment.
* chanmgr: Remove "Ident" from AbstractChannelNick Mathewson2022-10-181-12/+5
| | | | | Thanks to our previous changes, we no longer need this type, or the methods that access it.
* chanmgr: replace the HashMap<> with a ByRelayIds.Nick Mathewson2022-10-181-2/+2
| | | | | | | | | | | | | | | | | | This is necessary so that we can look up channels (open and pending) by all of the Ids that we know about them. The operations needed here are pretty complex: to get them right, I've replaced most of the accessors on the inner `ChannelMap` with a function that holds the lock while another `FnOnce` is called. This still gets us the invariant that we can't accidentally await while holding the lock on the `ChannelMap`. I've removed the tests for the accessors that are no longer there. There are some subtleties here. Now that we have more than one kind of Id, it's possible to have a partial match. I've tried to explain all these cases in the comments. }
* chanmgr: Edit comments, fix docsNick Mathewson2022-10-131-3/+11
|
* ChanMgr: Reorganize factory, builder, transport code.Nick Mathewson2022-10-131-221/+8
| | | | There is no actual code change here: just movement.
* Flatten TimeoutChannelFactory into ChannelBuilder.Nick Mathewson2022-10-131-46/+29
|
* Allow multiple ChannelBuilders to share a ChanMgrEventSender.Nick Mathewson2022-10-131-4/+8
|