aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/factory.rs
Commit message (Collapse)AuthorAgeFilesLines
* chanmgr: Responder relay channel now use the builder my_addrsDavid Goulet2026-02-241-7/+4
| | | | | | No need to pass from the arti relay binary our addresses when handling an incoming channel, use the one in the channel builder that an initiator channel uses.
* chanmgr: Add a set_relay_identities() to update the RelayIdentitiesDavid Goulet2026-02-241-0/+12
| | | | | | | | | | The arti-relay crate rotates the keys at regular interval which we need to give to the ChanMgr to update its builder. This function boldly replace the default factory with the new identities including the TLS acceptor can pick up the new key. Signed-off-by: David Goulet <[email protected]>
* relay: Pass advertised addresses to the channel handlerDavid Goulet2026-01-221-4/+8
| | | | | | | | | | | 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]>
* tor-chanmgr: wrap the peer address in `Sensitive`Steven Engler2025-11-051-3/+5
| | | | | For incoming connections, wrap the peer address in `Sensitive` as it could be a client.
* opentelemetry: Add some instrument macros.Wesley Aptekar-Cassels2025-09-241-1/+4
| | | | | I've added these in places that are useful for the debugging that I've been doing.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | 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-proto: Plumb the ChannelAccount through to queue creation siteIan Jackson2024-10-031-6/+10
| | | | | This gets it as far as the outbound circuit->channel mpsc queue creation. Also, we provide an accessor for it.
* tor-proto: Plumb the ChannelAccount through to queue creation site (pre-fmt)Ian Jackson2024-10-031-1/+3
|
* tor-chanmgr: Make a memquota::ChannelAcocunt per channelIan Jackson2024-10-031-0/+3
| | | | | 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: add experimental `ChanMgr::handle_incoming`Steven Engler2024-09-111-1/+47
| | | | | | | | | 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.
* tor-chanmgr: make `CompoundFactory` generic over `ChannelFactory`Steven Engler2024-09-111-28/+15
| | | | | | | | | | This has two advantages: 1. Code is a little easier to follow with generics rather than dynamic dispatch, especially since the type is fixed at compile time anyways. 2. It allows us to access associated types of the `ChannelFactory`, which will be useful later for getting the stream type from the `ChanBuilder`.
* proto: Make Channel explicitly Arc<.>Nick Mathewson2024-05-161-5/+5
| | | | | | | | | | | | | | | | 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.
* Resolve a pair of warnings about redundant closures.Nick Mathewson2023-08-221-1/+1
|
* Rename TransportHelper => TransportImplHelper.Nick Mathewson2022-11-301-1/+1
|
* Abolish ChanMgr::set_default_transportIan Jackson2022-11-301-6/+0
| | | | | | The comment says // TODO pt-client: It's not clear to me that we really need this method. and empirically, deleting it, and its callee, is fine.
* chanmgr: Report Pt errors correctly.Nick Mathewson2022-11-291-1/+1
| | | | | We were panicking if the PtMgr gave us an error, which isn't so good.
* tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuildereta2022-11-281-10/+52
| | | | | | | | | | | | | | | | | | | | | | | | 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).
* Draft: Pluggable transport managereta2022-11-281-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements `PtMgr`, a pluggable transport manager responsible for keeping track of spawned PTs and spawning them to satisfy client requests on demand. It does this in two parts: the `PtMgr` type exported to the rest of the code, and the background `PtReactor` that actually does the spawning; this design ensures that only one attempt to spawn a PT is active at a time, and will prove useful later for implementing e.g. timeouts. A few changes were necessary to the rest of the code in order to make this all work out. Namely: - `TransportRegistry`'s API didn't make any sense for two reasons: - It wasn't feasible for implementors to implement `ChannelFactory`, since that'd require constructing a `ChanBuilder` (which requires a bootstrap reporting event sender). - Treating the PT manager as a registry is over-general; it's only necessary for it to spawn pluggable transports, so saddling it with other concerns didn't make any sense. - (It's possible to get extensibility for arbitrary user customization by just letting the user swap in a new `ChannelFactory`, anyway.) - Therefore, the `PtMgr` implements the new `AbstractPtMgr` trait, which is far more narrowly focused; this only exists to solve a dependency loop, and is documented as such. - This provides a `TransportHelper` instead of a `ChannelFactory`.
* ChanMgr: Another attempt to build on CI.Nick Mathewson2022-11-231-1/+7
|
* ChanMgr: Rename Factory -> CompoundFactoryNick Mathewson2022-11-231-3/+3
|
* ChanMgr: Fix a few more conditional-compilation issuesNick Mathewson2022-11-231-0/+1
|
* ChanMgr: Remove Arc aliases.Nick Mathewson2022-11-231-12/+6
|
* Make ChannelFactory and AbstractPtMgr require Send+SyncNick Mathewson2022-11-231-5/+5
|
* ChanMgr: Implement functions that replace channel factories.Nick Mathewson2022-11-231-2/+79
| | | | | | | This commit makes it possible to replace the default channel factory (used when there is no PtMgr), and to replace the PtMgr. This is part of #659.
* ChanMgr: move the AbstractChanFactory into MgrState.Nick Mathewson2022-11-221-0/+3
| | | | | | We will want the freedom to replace this, so it needs to go behind a lock. We need to be able to Clone it cheaply now, so we're using an Arc instead of a Box.
* Merge branch 'main' into 'abstract-pt-mgr'Nick Mathewson2022-11-221-0/+2
|\ | | | | | | # Conflicts: # crates/tor-chanmgr/src/factory.rs
| * ChanMgr: Log every conection attempt at debug.Nick Mathewson2022-11-171-0/+2
| |
* | Replace TransportRegistry with AbstractPtMgreta2022-11-221-5/+18
|/ | | | | | | | | | | | | | | | | | It doesn't make much sense to have the pluggable transport manager be a registry, so replace its interface with a more narrowly defined, less generic version. Other changes: - instead of returning a &-reference, it returns an owned Arc, which should make the ptmgr easier to implement while allowing efficient reuse - provision for error handling is added, but will probably be revised in a future commit pending discussion - tor-ptmgr code that would generate warnings as a result of this change is temporarily removed This is a split out version of arti!886, intended so work on arti#659 can proceed.
* chanmgr: Edit comments, fix docsNick Mathewson2022-10-131-4/+12
|
* ChanMgr: Reorganize factory, builder, transport code.Nick Mathewson2022-10-131-60/+17
| | | | There is no actual code change here: just movement.
* chanmgr: clean up some TODO pt-client items and documentation.Nick Mathewson2022-10-131-74/+18
|
* chanmgr: Use ChannelFactory via a Box<dyn<ChannelFactory>>.Nick Mathewson2022-10-131-0/+16
| | | | | This will prepare for supporting multiple different ChannelFactory implementations.
* Implement ChannelFactory for (a wrapper of) TransportRegistry.Nick Mathewson2022-10-121-1/+23
| | | | This will let us just have ChanMgr take a `dyn ChannelFactory`.
* chanmgr: Clean up async-ness on factory types.Nick Mathewson2022-10-121-9/+17
| | | | | | | | The traits that launch connections need to be async; the traits that don't, shouldn't be async. Additionally, we need a few more "Sync" annotations here for the futures to work.
* ChanMgr: new (unimplemented) APIs for pluggable transportsNick Mathewson2022-09-231-0/+108