Commit Graph

5256 Commits

Author SHA1 Message Date
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
Ian Jackson fe0970e28e TransportId: Add test case for builtin Display repr 2022-11-22 14:59:21 +00:00
Nick Mathewson 2327e1f60f Merge branch 'atty' into 'main'
Ignore atty theoretical unaligned read for now

See merge request tpo/core/arti!883
2022-11-22 13:26:31 +00:00
Ian Jackson 639cc23da3 Ignore atty theoretical unaligned read for now 2022-11-22 12:54:21 +00:00
Ian Jackson ae848a8a0c Merge branch 'bridge-require' into 'main'
Refuse to run with bridges configured, but disabled in the build

Closes #644

See merge request tpo/core/arti!877
2022-11-21 18:40:39 +00:00
Ian Jackson 17002c7462 bridge non-support: Add doc notes to GuardMgrConfig::bridges_enabled 2022-11-21 16:46:19 +00:00
Ian Jackson ec7f058cfd bridge non-support: Test that we reject configs 2022-11-21 16:46:19 +00:00
Ian Jackson b2607fd8c8 bridge non-support: De-cfg the primary bridge config fields
We now parse the `bridges.enabled` BoolOrAuto, and the
`bridges.bridges` list.

The `bridges.bridges` list is Vec<()> in the builder, and Vec<Void> in
the built config.  Ie, it is simply a count, and vanishes in the built
config.

But this count triggers us to try to call build(), to try to parse
bridges, and to try to set and honour the enablement boolean.

The result is that the type system now ensures that if bridges are
disabled, but specified (either by listing them in the config, or
writing `enabled=true`), we inevitably try to insist that we have a
non-empty Vec<Void>, which is of course impossible.

There will be a test case too for those who think this too abstract a
way to guarantee this property :-).
2022-11-21 16:46:19 +00:00
Ian Jackson 939d11c034 bridge non-support: Provide a better BridgeConfigBuilder
This type now does all the things people expect of it: you can (try
to) deserialize it, parse it from a string, and call build on it.
2022-11-21 16:46:19 +00:00
Ian Jackson c4a3b0b5c4 bridge config: Feature-gate the error variants
This leaves this enum empty of actual errors, when bridge-client is
disabled.

We're going to add the not supported variant in a moment.
2022-11-21 16:46:19 +00:00
Ian Jackson 5800b1cdc9 bridge config: Move error to its own file
The dummy module is going to need an error type just like this but
with only the disabled variant.  To avoid that dummy enum getting out
of step with the nontrivial one, we're going to make them the same.

So as a first step, break this out into its own file.
2022-11-21 16:46:19 +00:00
Ian Jackson f087c7121d bridge non-support: Move dummy bridge module into own file
A bit more stuff is going to appear here, so it's getting to be rather
much for an inline module.
2022-11-21 16:46:19 +00:00