Commit Graph

5313 Commits

Author SHA1 Message Date
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
Ian Jackson 7688973fd4 arti cfg test: Break out expect_err_contains function
Maybe this will want to be in tor-error or something but put it here
for now.
2022-11-21 16:46:19 +00:00
Ian Jackson fa4f842340 bridge non-support: Disable the test for now
This test will start to fail if you compile without bridge support,
because we'll start rejecting the test configurations with bridges
specified.

We'll add a proper test for this later.
2022-11-21 16:46:19 +00:00
Ian Jackson 17ae757ffd Merge branch 'bridge-config-builder' into 'main'
Introduce BridgeConfigBuilder

Closes #604

See merge request tpo/core/arti!874
2022-11-21 16:24:26 +00:00
Ian Jackson a171f51c1a maint/matrix_test: Print what command we are running! 2022-11-21 15:47:08 +00:00
Ian Jackson 2c37116149 tor-config: introduce ConfigBuildError::Unsupported
And use it in bridge configuration parsing.
2022-11-21 15:46:53 +00:00
Ian Jackson ac4869633a tor-config: ConfigBuildError::within: Introduce add_prefix 2022-11-21 15:46:53 +00:00
Ian Jackson 681b4062ff bridge config builder: Introduce error constructor helpers (fmt noise) 2022-11-21 15:46:53 +00:00
Ian Jackson 85d7651827 bridge config builder: Introduce error constructor helpers
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=12d13428d8fcc68b7b0f231bac9fc130b3eeb18b#d53209cbcd12771c549f3a130379ecb65dd60145_100_193
2022-11-21 15:46:53 +00:00
Ian Jackson b0bd9b3fb3 bridge config builder: Document one id of each type restriction
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_124
2022-11-21 14:58:24 +00:00
Ian Jackson 897d8a0ee3 bridge config builder: Document PT one address restriction
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/874/diffs?commit_id=620cc90f6dcdad20f49a001a9e04d191a323e904#d53209cbcd12771c549f3a130379ecb65dd60145_100_121
2022-11-21 14:58:24 +00:00
Ian Jackson 58710b9635 Make the bridge list in the builder be a list of BridgeConfigBuilder
By changing MultilineListBuilder.
2022-11-21 14:58:24 +00:00
Ian Jackson 9aa1c56fc9 BridgeConfigBuilder: Allow (de)ser to/from bridge lines
That the *de*serialisation works as expected will be tested properly
in just a moment, because when we plumb this all the way through, it
will be what parses the bridge lines in the example config file.
2022-11-21 14:58:24 +00:00
Ian Jackson 91536da10a tor-basic-utils: Provide helper for serde flexible parsing 2022-11-21 14:58:24 +00:00
Ian Jackson 345d8e130b BridgeConfigBuilder: Implement FromStr 2022-11-21 14:58:24 +00:00
Ian Jackson cd2070b3ba BridgeConfigBuilder: Introduce build() function
And test cases for it, and its errors.
2022-11-21 14:58:24 +00:00
Ian Jackson 589f74a78f BridgeConfigBuilder: Introduce the struct with the dictionary repr
This struct is going to be the principal "dictionary-style" serde
representation for a bridge, and the builder, making this all in
keeping with our usual approach.

In this commit:
 * Introduce the struct (defining the serialisation)
 * Provide the setters (defining the Rust API)
 * Add success test cases (not all of the data in which is used yet)
2022-11-21 14:58:24 +00:00
Ian Jackson 2327c7657c tor-basic-utils: list_builder: Introduce DirectDefaultEmptyListBuilderAccessors
This trait can have this ludicrously long name because no-one needs to
import it.
2022-11-21 14:54:39 +00:00
Ian Jackson 88b60a1fa7 BridgeAddr rename: update tor_guardmgr::bridge::config
Here is where my motivation is and I'm working on this code now, so do
this renaming cleanup now.
2022-11-21 14:54:39 +00:00
Ian Jackson fec66077de BridgeAddr rename from PtTargetAddr: Update in tor-linkspec
And the error too.

We need this for the API for BridgeConfigBuilder, where the user can
specify any kind of target "address", even a hostname.

It's already non-conditional, it's just that the name is too limiting.

In this commit:
 * Change in tor-linkspec
 * Export transitional aliases
 * Add TODOs to remove the transitional aliases
2022-11-21 14:54:39 +00:00
Ian Jackson 224f4905e4 tor-linkspec: Provide deconstructors for PtTargetSettings and PtTarget 2022-11-21 14:54:39 +00:00
Ian Jackson 0b14b93f76 arti-client, tor-config: Remove stability warning from top-level docs
Ticket #285 is closed and most of this is stable now we think.

(There are still a couple of stability warnings for specific types in
tor-config, which aren't exposed at the arti-client level.)
2022-11-21 12:06:27 +00:00
Nick Mathewson 3520505a2c Merge branch 'cfg-allow' into 'main'
cfg compilation: Add two allows

See merge request tpo/core/arti!876
2022-11-18 19:29:45 +00:00
Ian Jackson 113341e397 cfg compilation: Add two allows 2022-11-18 18:50:00 +00:00
Ian Jackson 285a7988bb Merge branch 'fix_nightly_20221118' into 'main'
Fix warnings and breakage in nightly (2022-11-18 edition)

See merge request tpo/core/arti!872
2022-11-18 16:43:16 +00:00
Ian Jackson d6f567b8ef fixup! tor-guardmgr: Fix visibility of TestConfig with no features enabled 2022-11-18 16:40:28 +00:00
Ian Jackson 7ec52057dc tor-guardmgr: Fix visibility of TestConfig with no features enabled
Without this, tor-guardmgr tests don't build when run without the
crate's own testing feature enabled.
2022-11-18 16:30:46 +00:00
Nick Mathewson 122c796fac Merge branch 'fix_ownedchantarget_missing' into 'main'
Fix a missing import in tests.

See merge request tpo/core/arti!873
2022-11-18 16:07:33 +00:00
Nick Mathewson 483b857d78 Merge branch 'fix_nightly_version' into 'main'
gitlab-ci: Pin to nightly-2022-11-05

See merge request tpo/core/arti!871
2022-11-18 15:44:41 +00:00
Nick Mathewson de9f3177b0 Fix a missing import in tests.
I'm not sure why the CI didn't reject this the first time around.
2022-11-18 10:34:19 -05:00
Nick Mathewson 47041bd4ce Merge branch 'refactor_into_ownedchantarget' into 'main'
CircMgr: Refactor DirSpecificTarget constructor

See merge request tpo/core/arti!866
2022-11-18 15:21:46 +00:00
Nick Mathewson 829cb708e2 Fix a couple of rustdoc issues.
These slipped in while nightly was broken.
2022-11-18 10:19:54 -05:00
Nick Mathewson d51162e55b Fix a bunch of "needless borrow" warnings on nightly
It looks like, despite a few false starts, they've got this warning
right; there weren't any false positives.
2022-11-18 10:12:05 -05:00
Nick Mathewson e8701b1e9e gitlab-ci: Pin to nightly-2022-11-11
This is a workaround for #633.
2022-11-18 10:02:27 -05:00
Nick Mathewson ec148a63cb CircMgr: Refactor DirSpecificTarget constructor
This commit replaces the
`impl From<&T> for OwnedChanTarget where T:ChanTarget`
with a new `IntoOwnedChanTarget` trait. This lets us be explicit
that we're constructing an owned object, and not just converting
something.

No semver change needed, since these APIs haven't been released.

----------- (new description)
2022-11-18 09:55:46 -05:00
Nick Mathewson c666133be4 Merge branch 'mark-bridges-not-experimental' into 'main'
Mark bridge and PT-related APIs as non-experimental.

Closes #643

See merge request tpo/core/arti!865
2022-11-18 14:22:31 +00:00
Nick Mathewson 76e41b8bf6 circmgr: make some imports conditional
This resolves an "unused import" warning when bridges are not
enabled.
2022-11-18 08:53:47 -05:00
Nick Mathewson 2c366927cc arti-client: make bridge-client depend on dirmgr/bridge-client
This resolves some errors when building with `bridge-client` but not
with `--all-features`.
2022-11-18 08:53:47 -05:00
Nick Mathewson b0e337d22d arti: Mark bridge and pt support non-experimental, and on-by-default 2022-11-18 08:53:47 -05:00
Nick Mathewson 9229e1a59b arti: Split long lines in Cargo.toml
This will make the next commit easier to review.
2022-11-18 08:53:47 -05:00
Nick Mathewson f1f6005474 arti-client: Mark "bridge-client" and "pt-client" as non-experimental 2022-11-18 08:53:47 -05:00
Nick Mathewson 09591bcc5a arti-client: split long lines in Cargo.toml
Doing this separately to make the next commit easier to read.
2022-11-18 08:53:47 -05:00
Nick Mathewson 9f661e264f dirmgr: make "bridge-client" non-experimental. 2022-11-18 08:53:47 -05:00
Nick Mathewson 471cdc77f2 guardmgr: Make bridge-client and pt-client non-experimental 2022-11-18 08:53:47 -05:00