Commit Graph

5267 Commits

Author SHA1 Message Date
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
Nick Mathewson f8e103bb94 Mark set-default-factory API as experimental. 2022-11-23 11:10:34 -05:00
Nick Mathewson c04aa9baed Make ChannelFactory and AbstractPtMgr require Send+Sync 2022-11-23 11:10:34 -05:00
Nick Mathewson bc1de60d6d ChanMgr: Implement functions that replace channel factories.
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.
2022-11-23 11:10:34 -05:00
Ian Jackson ecaf8b23b8 tor-guardmgr: Refuse to configure bridges if we don't have the lock
Fixes #612
2022-11-23 13:03:14 +00:00
Ian Jackson c0b297c99c tor-guardmgr: make replace_bridge_config fallible
The error type needs to be convertible to GuardMgrError and also to
ReconfigureError.  Neither of those is right, so we need a new error
type.
2022-11-23 13:00:10 +00:00
Ian Jackson 8cddb0a06a tor-guardmgr: Replace a let _ignore with a typed version
`let _ignore =` isn't great because if the function called is
currently infallible, but becomes fallible, it suppresses the
detection of the error check.

A better pattern is to specify the type of the ignored value.

I'm about to do precisely this, here.

I did a git-grep and `let _ignore =` seems very common.  Let's not
deal with all those now.
2022-11-23 13:00:05 +00:00
Nick Mathewson a688e4afc9 ChanMgr: move the AbstractChanFactory into MgrState.
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.
2022-11-22 14:41:44 -05:00
Nick Mathewson fc74bb8bb4 Merge branch 'retire_on_guard_cfg_change' into 'main'
CircMgr: retire all circuits if bridge configuration changes.

Closes #650

See merge request tpo/core/arti!880
2022-11-22 19:00:20 +00:00
Nick Mathewson 07599615b9 Merge branch 'abstract-pt-mgr' into 'main'
Replace TransportRegistry with AbstractPtMgr

See merge request tpo/core/arti!887
2022-11-22 18:59:20 +00:00
Nick Mathewson 09092394a8 Merge branch 'main' into 'abstract-pt-mgr'
# Conflicts:
#   crates/tor-chanmgr/src/factory.rs
2022-11-22 18:12:25 +00:00
eta 2f75702cec Replace TransportRegistry with AbstractPtMgr
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.
2022-11-22 18:09:06 +00:00
Nick Mathewson f2121101d1 Even more comments explaining circuit cancellation. 2022-11-22 12:53:32 -05:00
Nick Mathewson e7c942c918 Improve notes surrounding circuit cancellation.
It turns out that bug #656 is not a real bug, but it was easy to
overlook the code that prevented it.

Closes #656.
2022-11-22 12:53:32 -05:00
Nick Mathewson c0aa10d409 CircMgr: retire all circuits if bridge configuration changes.
Closes #650.
2022-11-22 12:53:32 -05:00
Ian Jackson 7a082cb8f0 Merge branch 'bridge-transp-parse' into 'main'
Use TransportId FromStr in BridgeConfig parsing

Closes #653

See merge request tpo/core/arti!881
2022-11-22 16:27:43 +00:00
Ian Jackson ee87097dc1 BridgeConfig: Replace all Arc<BridgeConfig> with BridgeConfig
BridgeConfig is itself an Arc now, so these are redundant.
2022-11-22 15:33:21 +00:00
Ian Jackson 3caf7aafc0 BridgeConfig: Make it be a newtype around Arc<Inner>
This leaves the external API of this type unchanged, but now it's much
smaller and quite cheap to clone.
2022-11-22 15:33:21 +00:00
Ian Jackson 5d8d3f79fa bridge config: Remove a done TODO
This was done by !874 and #604 closed accordingly.
2022-11-22 15:08:28 +00:00
Ian Jackson 822a6ce32b TransportId: Fix test case for no pt-target
Fixes

  cargo +stable clippy --manifest-path=/home/ian/Rustup/Arti/arti/Cargo.toml --locked --target-dir=target --offline -p tor-linkspec --no-default-features --all-targets

giving

  446 |             .method(ChannelMethod::Pluggable(PtTarget::new(
      |                                    ^^^^^^^^^ variant or associated item not found in `transport::ChannelMethod`
2022-11-22 14:59:25 +00:00
Ian Jackson 8406474435 bridge config parsing tests: Show expected error message in asssrt 2022-11-22 14:59:25 +00:00
Ian Jackson 987f67d7f6 bridge config parsing: Parse transport as TransportId (fmt) 2022-11-22 14:59:25 +00:00
Ian Jackson e57d3061db bridge config parsing: Parse transport as TransportId
Fixes #653
2022-11-22 14:59:25 +00:00
Ian Jackson 6b2940bb7d bridge config parsing: Move unsupported block
This will make the next commit textually smaller.
2022-11-22 14:59:25 +00:00
Ian Jackson 28ca346297 TransportId: Parse "bridge" as builtin transport
This will allow  transport="bridge"  in bridge configurations, etc.
Doing it at this layer means it will be recognised everywhere.
2022-11-22 14:59:25 +00:00
Ian Jackson 813f0a71c9 TransportId: Provide new_builtin and new_pluggable
I think normal Rustic practice is to provide a real constructor as
well as just `Default`.
2022-11-22 14:59:25 +00:00
Ian Jackson 331aa673ea TransportId: Provide name accessor and deconstructor
We are maintaining the notion that at some point this thing might
grow additional variants.
2022-11-22 14:59:25 +00:00
Ian Jackson 4b8010782a TransportId: Document and change string repr for builtin
* Change the Display of builtin to "-"
 * Parse "" and "-" as builtin, as well as "<none>"
 * Document this
2022-11-22 14:59:21 +00:00