Commit Graph

252 Commits

Author SHA1 Message Date
Nick Mathewson dc2c00e282 Merge branch 'doc-config-must' into 'main'
tor-config: Document how to reject compiled-out features

Closes #654

See merge request tpo/core/arti!929
2022-12-07 13:20:09 +00:00
Ian Jackson dc3c7651ca tor-config: Document how to reject compiled-out features
Fixes #654
2022-12-06 15:51:43 +00:00
Ian Jackson f3fa77be6f tor-config: Add "particular situations" sections and mention list_builder 2022-12-06 15:51:31 +00:00
Ian Jackson ba338bdf37 tor-config: Update to shellexpand 3.x
This is the new upstream version (published by me, recently).
It has the same MSRV and one breaking change:

The caller who specifies a home dir function for substituting into
strings, must now supply a string, not Path.  Previously shellexpand
would allow the caller to supply non-unicode data, and then simply not
substitute it.  That was an infelicity in the shellexpand API.

Now this infelicity is pushed into our code.  The overall behaviour of
Arti hasn't changed as a result.  And it seems reasonable to me.

shellexpand 3.x also has a module for expanding Paths instead, in
response to requests for this filed as upstream tickets.  We *could*
use that but I am not sanguine about that approach: the Pathness would
spread throughout much of our config and file handling code.

I think we should at the very least postpone trying to work with
invalid-unicode-paths as long as we can.
2022-12-06 15:15:22 +00:00
Ian Jackson 010ffd6ea6 tor-config: home dir handling: fmt pre-patch 2022-12-06 15:11:58 +00:00
Nick Mathewson e0aeda3071 Remove semver.md files now that 1.1.0 is released. 2022-11-30 17:10:29 -05:00
Nick Mathewson 38bef96b99 Bump the minor version of every crate.
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Ian Jackson f3c8b0433b tor-basic-utils: list_builder: Use standard test lint block
This gets rid of a spurious warning on nightly about the use of dbg!
2022-11-29 18:41:56 +00:00
Ian Jackson cdc1e574f9 tor-config MultilineListBuilder: Test deserialisation 2022-11-29 17:53:04 +00:00
Ian Jackson 255f3b6bf6 tor-config MultilineListBuilder: Print line number starting at 1, not 0 2022-11-29 17:53:04 +00:00
Ian Jackson ef07c2e99d tor-config list_builder tests: Move Outer up a level
We're going to reuse this.
2022-11-29 17:53:04 +00:00
Ian Jackson 71e81bf7b4 MultilineListBuilder: Use a manual implementation of Deserialize
The error message from `#[serde(untagged)]` would otherwise start to
appear when we try to deserialise unsupported PT configurations, when
compiled with bridge but not PT support.
2022-11-29 16:32:14 +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
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 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 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 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 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 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 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 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 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
Nick Mathewson 932fe48eaf Run add_warnings. 2022-11-03 11:06:02 -04:00
Nick Mathewson 5786637b4f Fix various typos (using typos tool and hand-inspection) 2022-10-18 15:39:33 -04:00
Ian Jackson f84d8777db cargo fmt to remove blank lines
Apparently cargo fmt doesn't like these, which my perl rune didn't
delete.

This commit is precisely the result of `cargo fmt`.
2022-10-12 15:29:04 +01:00
Ian Jackson d9910dba08 Replace all README copies in src/lib.rs with includes
The feature we want is `#[doc = include_str!("README.md")]`, which is
stable since 1.54 and our MSRV is now 1.56.

This commit is precisely the result of the following Perl rune:
  perl -i~ -0777 -pe 's{(^//!(?!.*\@\@).*\n)+}{#![doc = include_str!("../README.md")]\n}m' crates/*/src/lib.rs
2022-10-12 15:29:03 +01:00
Nick Mathewson 63cd6b0c87 Fix error message 2022-10-12 13:50:29 +01:00
Ian Jackson cb1adb0103 tor-config: Provide MultilineListBuilder
This is what we'll use to parse the `bridges.bridges` config key.
2022-10-12 13:50:29 +01:00
Ian Jackson debfa1f107 tor-config: Remove unneeded braces in an example 2022-10-12 13:50:29 +01:00
Ian Jackson 4a6ac4090c tor-config: Provide BoolOrAuto
We're going to use this for the config item `bridges.enabled`,
but it seems general enough that it ought to go here.
2022-10-12 13:50:29 +01:00
Ian Jackson b766b16e46 tor_config: define_list_builder_helper: Support custom serde
We're going to want something that has the standard list builder
methods at the Rust API, but which has different serialisation.

Sadly the implementation is annoying, because macro_rules makes it
hard to parse a nice input syntax.
2022-10-12 13:50:29 +01:00
Ian Jackson 82ad9eea5f Allow "clippy::single_char_pattern" in tests.
This lint exists for perf reasons, and this is rarely relevant in
tests.

Using double quoted str is generally cognitively less burdensome.
2022-10-12 13:50:29 +01:00
Ian Jackson d6b85b27c4 tor-config: CfgPath: Fix two typos "expaneded" 2022-10-11 11:22:49 +01:00
Nick Mathewson e005d38edb CfgPath: Add support for ${PROGRAM_DIR}.
`${PROGRAM_DIR}` expands to the equivalent of
`std::env::current_exe().parent()`, with appropriate unwrapping and
conversions.

It is expected to be useful for finding the locations of pluggable
transports in some kinds of bundles.

Closes #586.
2022-10-07 09:03:00 -04:00
Nick Mathewson f5389b53e9 Bump crates that have had no API changes. 2022-10-03 09:47:09 -04:00
trinity-1686a 8e7a904260 fix clippy::needless_borrow 2022-09-10 14:39:47 +02:00
Nick Mathewson a5f704f443 Remove semver.md from arti-1.0.0 2022-09-07 09:17:00 -04:00
Nick Mathewson 96875ea208 Bump crate versions in preparation for Arti 1.0.0 release.
Because we want to work more on ensuring that our semver stability
story is solid, we are _not_ bumping arti-client to 1.0.0 right now.

Here are the bumps we _are_ doing.  Crates with "minor" bumps have
had API breaks; crates with "patch" bumps have had new APIs added.

Note that `tor-congestion` is not bumped here: it's a new crate, and
hasn't been published before.

```
tor-basic-utils         minor
fs-mistrust             minor
tor-config              minor
tor-rtcompat            minor
tor-rtmock              minor
tor-llcrypto            patch
tor-bytes               patch
tor-linkspec            minor
tor-cell                minor
tor-proto               minor
tor-netdoc              patch
tor-netdir              minor
tor-persist             patch
tor-chanmgr             minor
tor-guardmgr            minor
tor-circmgr             minor
tor-dirmgr              minor
arti-client             minor
arti-hyper              minor
arti                    major
arti-bench              minor
arti-testing            minor
```
2022-09-01 08:59:49 -04:00
Nick Mathewson 874ba13501 Fix a rustdoc link error. 2022-08-31 12:24:39 -04:00
Nick Mathewson 8d6a1ea6ec Merge branch 'refactor-anyhow-arti-crate' into 'main'
Remove `anyhow` from `tor-config` crate

See merge request tpo/core/arti!707
2022-08-31 13:14:46 +00:00
Ian Jackson e2104e4cce tor-config: DisfavouredKey: Linkify Display 2022-08-30 13:24:06 +01:00
Ian Jackson 71122a61b6 tor-config: DisfavouredKey: Widen applicability of .to_string()
And linkify it.
2022-08-30 13:24:06 +01:00
Alexander Færøy 4c2fd18d35 Add documentation note on `to_string()` usage for DisfavouredKey. 2022-08-30 13:24:06 +01:00
Arturo Marquez 7d3d24cddf
Remove `anyhow` from `tor-config` crate 2022-08-28 18:07:53 -05:00
Nick Mathewson 496a5be749 Merge branch 'clippy' into 'main'
tor-config: tests: Apply standard lint block in sources.rs

See merge request tpo/core/arti!694
2022-08-26 12:56:25 +00:00
Nick Mathewson 88fa24d029 Improve error from bad escapes in a toml config.
Whereas previously we would say:

```
target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml
```
we now say:
```
target/debug/arti: error: invalid escape character in string: `Z` at line 9 column 14 in ../../.config/arti/arti.toml   (If you wanted to include a literal \ character, you need to escape it by writing two in a row: \\)
```

The implementation is a bit of a hack, I'm afraid, but I don't think
it's all that bad.

Closes #549.
2022-08-25 15:04:52 -04:00
Ian Jackson 3faf4475cc Bump toml dependency
We need
  60b874308e6792a73cc00517a60bbef60a12e3cc
  Mixed type arrays (#358)
for a test case in tor-config.

While we're here, drop the dupe entry in tor-config.

(In principle we could make this increase only in tor-config's
dev-dependencies, but that seems unnecessarily fiddly.)
2022-08-25 18:41:28 +01:00
Ian Jackson 76066dac81 tor-config Listen: Rename localhost_port_legacy (from _deprecated)
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/602#note_2830847
2022-08-25 18:41:28 +01:00