summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/builder.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* chanmgr: Move Timeout functionality into a decorator object.Nick Mathewson2022-10-131-10/+46
|
* Have ChannelBuilder use TransportHelper.Nick Mathewson2022-10-131-22/+85
| | | | | | This lets us build channels using different TransportHelpers, including the (new) default TransportHelper, which just uses the old connect_to_one() code.
* Rename mgr::ChannelFactory to mgr::AbstractChannelFactoryNick Mathewson2022-10-121-2/+2
| | | | | | | | | This is an internal type (distinct from factory::ChannelFactory) that we use to make the code in `tor_chanmgr::mgr` agnostic about what a channel actually is, and how it is actually launched. Therefore, I'm renaming it and giving better documentation in a couple of places, to prevent confusion.
* Change multiplicity of ChannelMethod and addressesNick Mathewson2022-10-111-12/+8
| | | | | | | Now each `ChanTarget` has at most one `ChannelMethod`, and only `Direct` `ChannelMethods` can have multiple addresses. Closes #600.
* Allow two useless pattern matches that are going to be not uselessIan Jackson2022-10-111-0/+1
|
* Move two users of HasAddrs to HasChannelMethodsNick Mathewson2022-10-061-2/+11
| | | | All the other users of HasAddrs are correct.
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-1/+8
| | | | These are now builders.
* tor-proto: Preserve the ChannelMethod, not the SocketAddrNick Mathewson2022-10-061-1/+1
|
* tor-chanmgr: don't log addresses so much.Nick Mathewson2022-08-251-2/+3
| | | | | We now log connection attempts at debug!, and mark relay target addresses as sensitive.
* Rename ChannelsParams types to ChannelPaddingInstructions (fmt)Ian Jackson2022-08-171-1/+4
| | | | Run rustfmt; no other changes.
* Rename ChannelsParams types to ChannelPaddingInstructionsIan Jackson2022-08-171-2/+2
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826167 This makes some lines too long; I will run rustfmt in a separate commit for clarity.
* Channel: Make mutable() and engage_padding_activities infallibleIan Jackson2022-08-171-3/+2
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826151 This gets rid of quite some Bug error paths.