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
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