Commit Graph

5140 Commits

Author SHA1 Message Date
Nick Mathewson 3fa86f41a6 Revise the API of "PtMgr::reconfigure"
I prefer that it not take `&mut self`, since PtMgr already has
interior mutability.

I also need it to take `tor_config::Reconfigure` argument, in case
it gains any more smarts about validation in the future.
2022-11-28 17:29:23 -05:00
Nick Mathewson c99017b0d6 ptmgr: Note a TODO issue around TempDir. 2022-11-28 17:29:23 -05:00
Nick Mathewson 4b5be3685f ptmgr: Fill in some error-related code; resolve TODOs. 2022-11-28 17:29:23 -05:00
Nick Mathewson 1fa9296f9c ptmgr: clear up unused_import exceptions. 2022-11-28 17:29:23 -05:00
Nick Mathewson 6bde90ce01 PtMgr: New features section in README.md
Per convention, have a `full` feature.

Also, downgrade the 'TODO pt-client' entries in README::limitations,
since they are not blockers for 1.1.0.
2022-11-28 17:29:23 -05:00
Nick Mathewson 8d0ac9bdc8 ptmgr: Mark PtMessage and next_message as experimental-api.
These are implementation details and we don't want to mark them as
stable.

To do this, I needed to apply some additional options to the example
code's configuration in Cargo.toml.
2022-11-28 17:29:23 -05:00
Nick Mathewson d6642ef6ac Merge branch 'ptmgr-draft' into 'main'
Pluggable transport manager

See merge request tpo/core/arti!886
2022-11-28 19:44:18 +00:00
eta a3c9fc5b1a tor-chanmgr: Introduce the BootstrapReporter API, publicize ChanBuilder
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).
2022-11-28 13:52:21 -05:00
eta 3b41c78d6f Draft: Pluggable transport manager
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`.
2022-11-28 13:52:21 -05:00
Nick Mathewson 8cf9e2a6a4 Merge branch 'chanmethod-non-exhaustive' into 'main'
Make ChannelMethod non-exhaustive

See merge request tpo/core/arti!891
2022-11-27 19:36:22 +00:00
Nick Mathewson 984bd6012a Merge branch 'reconfig-bridges-bad' into 'main'
Require state ownership when using bridges

Closes #612

See merge request tpo/core/arti!889
2022-11-27 19:30:00 +00:00
Nick Mathewson c80702cf39 Merge branch 'rustls-0.20' into 'main'
Rustls 0.20

Closes #305

See merge request tpo/core/arti!821
2022-11-27 19:28:32 +00:00
trinity-1686a fda17829d5 fix deprecation warnings from rustls 2022-11-26 10:23:05 +01:00
trinity-1686a 0a917a1abc upgrade rustls to 0.20, ignoring all deprecation warnings 2022-11-26 10:23:05 +01:00
Ian Jackson 1a39a0c7e9 Make ChannelMethod non-exhaustive
Enums with variants conditional on cargo features must be
non-exhaustive, because cargo features are supposed to be additive,
meaning that enabling a feature (which might happen due to some random
distant thing) ought not to break things using that enum.

There were surprisingly few places to fix this.
2022-11-24 17:17:36 +00:00
Ian Jackson c1fbf06e63 Merge branch 'restore_nightly' into 'main'
Switch CI back to nightly.

Closes #633

See merge request tpo/core/arti!884
2022-11-24 16:23:39 +00:00
Ian Jackson 04082ab7a9 tor-guardmgr: rustfmt for recent changes
Left unsquashed for ease of review
2022-11-24 14:31:05 +00:00
Ian Jackson ecd0e121a8 tor-guardmgr: NoLock error: add TODO for trying to get lock
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856874
2022-11-24 14:31:05 +00:00
Ian Jackson 112e28d88e tor-config: Rename to ReconfigureError::UnsupportedSituation
From Unsupported.  Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856873
This was added in this MR.

Also add the missing semver note.
2022-11-24 14:31:03 +00:00
Ian Jackson fa918446ac tor-config: Rename to ConfigBuildError::NoCompileTimeSupport
From Unsupported.  Following one of the suggestions here
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/889#note_2856873

This was added in 2c37116149 which was
not yet in a release so this isn't a semver break.  I have added
the semver note that was omitted in that MR.
2022-11-24 14:30:58 +00:00
Nick Mathewson c93d7d6e90 Switch CI back to nightly.
Now that they have merged
https://github.com/rust-lang/rust/pull/104416 ,
our CI should pass again with the regular nightly image.

Rather than remove the pinned image entirely, I'm commenting it out,
with a comment explaining how to pin an image the next time we need
to do so.

Closes #633.
2022-11-24 12:06:23 +00:00
Ian Jackson 90a1a10b3c Merge branch 'sensitive-error' into 'main'
Scrub channel target information in errors

See merge request tpo/core/arti!890
2022-11-23 20:18:17 +00:00
Ian Jackson dc13c93491 Merge branch 'bdm-dormant' into 'main'
bridge desc mgr: Honour specified dormancy

Closes #630

See merge request tpo/core/arti!861
2022-11-23 20:13:29 +00:00
Ian Jackson 6a39cdfe57 Merge branch 'watch-drop-option' into 'main'
tor-basic-utils: DropNotifyWatchSender: use DropNotifyEofSignallable

See merge request tpo/core/arti!853
2022-11-23 18:55:32 +00:00
Ian Jackson ef5a58e158 tor-dirclient: Replace OwnedChanTarget with LoggedChanTarget in SourceInfo
SourceInfo primarily appears in errors, here and in (indirectly)
tor-dirmgr.

This
 1. Makes the errors smaller
 2. Redacts (currently, scrubs) the chantarget when safe logging is enabled

This commit therefore deals with both tor-dirmgr and tor-dirclient
errors, from the pov of error information that should become sensitive
as part of bridge support.

The error pyaloads directly in tor_dirmgr/src/err.rs don't seem to
contain anything in that category.
2022-11-23 18:28:38 +00:00
Ian Jackson b822e2ebe9 tor-cirmgr: Replace OwnedChanTarget with LoggedChanTarget in errors
This
 1. Makes the errors smaller
 2. Redacts (currently, scrubs) the chantarget when safe logging is enabled

The other error variants in tor-circmgr::Error don't seem to contain
information that should become sensitive as part of bridge support.
2022-11-23 18:28:38 +00:00
Ian Jackson e635383dfb tor-chanmgr: Invent [Box]ChanSensitive for two error payloads
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.
2022-11-23 18:28:38 +00:00
Ian Jackson 32357b3de7 tor-chanmgr: Replace OwnedChanTarget with LoggedChanTarget in errors
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.
2022-11-23 18:28:38 +00:00
Ian Jackson 45a79bf725 tor-linkspec: Provide LoggedChanTarget type alias and utility method
This makes it easy to talk about, and construct, a
BoxSensitive<OwnedChanTarget>, which is what we'll use in errors.
2022-11-23 18:28:38 +00:00
Ian Jackson bbc84bf9f4 safelog: Provide BoxSensitive 2022-11-23 18:28:38 +00:00
Ian Jackson 4f193f1017 safelog: Remove type argument from `impl_display_traits`
We're going to have this same macro implement the same traits for a
second type.  And its function is specific to `Sensitive`, so have it
know that.
2022-11-23 18:28:34 +00:00
Ian Jackson b77fd893a4 safelog: Provide some more accessors
We're about to use `.as_inner()` in a few places, and `.as_ref()` (by
analogy with `Option`) seems obviously necessary.
2022-11-23 18:28:34 +00:00
Ian Jackson 1c085cf401 bridge desc mgr: Add dormancy comment to effective_parallelism
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/861#note_2856922
2022-11-23 18:20:58 +00:00
Ian Jackson 68acedccfd bridge desc mgr: Test dormancy 2022-11-23 18:20:58 +00:00
Ian Jackson e0c4eed549 bridge desc mgr: Honour specified dormancy
Fixes #630
2022-11-23 18:20:58 +00:00
Ian Jackson a33df9a5f5 bridge desc mgr: Introduce effective_parallelism helper 2022-11-23 18:20:58 +00:00
Ian Jackson 2c98351e2d bridge desc mgr: Move set_dormancy to impl that is for mock too 2022-11-23 18:20:58 +00:00
Nick Mathewson ce0f8f41cb Merge branch 'bridge-config-arc' into 'main'
Make BridgeConfig be Arc, so no Arc<BridgeConfig>

Closes #635

See merge request tpo/core/arti!885
2022-11-23 17:52:26 +00:00
Ian Jackson fbd4b88044 Merge branch 'test-config' into 'main'
tor-guardmgr: Fix visibility of TestConfig with no features enabled

See merge request tpo/core/arti!875
2022-11-23 17:51:05 +00:00
Nick Mathewson 4c5a88c925 Merge branch 'matrix-test' into 'main'
maint/matrix_test: Print what command we are running!

See merge request tpo/core/arti!879
2022-11-23 17:50:30 +00:00
Ian Jackson 4d502bd818 arti-client: Add comment about Option DormantMode
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/852#note_2854090
(ftaod, that is a different MR to this one)
2022-11-23 17:50:05 +00:00
Ian Jackson c82cda85d6 tor-basic-utils: DropNotifyWatchSender: use DropNotifyEofSignallable
This will help avoid the programmer making the mistake I made here:
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/852#note_2854029
2022-11-23 17:50:05 +00:00
Nick Mathewson c0a6fb3e0f Merge branch 'stability' into 'main'
arti-client, tor-config: Remove stability warning from top-level docs

See merge request tpo/core/arti!878
2022-11-23 17:50:01 +00:00
Ian Jackson 63a799a118 tor-basic-utils: DropNotifyWatchSender test: introduce I
We do want to test this with a non-Option type, but we are going to
have to wrap it up.
2022-11-23 17:50:01 +00:00
Nick Mathewson e25ed00fd1 Merge branch 'remove_deadcode_allow' into 'main'
guardmgr: Remove a now-unneeded "allow(dead_code)"

See merge request tpo/core/arti!862
2022-11-23 17:45:26 +00:00
Nick Mathewson f60eb449d3 Merge branch 'install_mgr' into 'main'
ChanMgr: Implement the functions needed to install a ChannelFactory and an AbstractPtMgr.

See merge request tpo/core/arti!888
2022-11-23 16:57:10 +00:00
Nick Mathewson 3f5699b95a ChanMgr: Another attempt to build on CI. 2022-11-23 11:25:15 -05:00
Nick Mathewson 74ebc904e3 ChanMgr: Rename Factory -> CompoundFactory 2022-11-23 11:10:34 -05:00
Nick Mathewson 1249bedbb0 ChanMgr: Fix a few more conditional-compilation issues 2022-11-23 11:10:34 -05:00
Nick Mathewson 2fb36f5585 ChanMgr: Remove Arc aliases. 2022-11-23 11:10:34 -05:00