Commit Graph

149 Commits

Author SHA1 Message Date
Ian Jackson 9318e8712a Fix clippy needless deref 2022-07-06 12:05:57 +01:00
Ian Jackson 8f63c07b5f tor-netdoc: b64 tests: add exhaustive roundtrip test 2022-07-06 12:04:23 +01:00
Arturo Marquez af4970ec1f
Bump `base64ct` crate `1.5.0` -> `1.5.1`
This new release checks for invalid symbols in non-padded inputs
for decoding. Therefore, we can get rid of the logic implemented
in `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600`
2022-06-27 23:10:58 -05:00
Nick Mathewson 1dda69af2b Remove semver.md files now that 0.5.0 is out 2022-06-24 13:31:38 -04:00
Nick Mathewson 20435aea75 Bump crate and dependency versions.
These were done with the following commands:

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p fs-mistrust       --bump minor
cargo set-version -p tor-error         --bump patch
cargo set-version -p tor-config        --bump patch
cargo set-version -p tor-units         --bump patch
cargo set-version -p tor-rtcompat      --bump minor
cargo set-version -p tor-llcrypto      --bump patch
cargo set-version -p tor-bytes         --bump minor
cargo set-version -p tor-socksproto    --bump minor
cargo set-version -p tor-cert          --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-proto         --bump minor
cargo set-version -p tor-netdoc        --bump patch
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump patch
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump patch
cargo set-version -p tor-dirclient     --bump patch
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump patch
cargo set-version -p arti              --bump minor
cargo set-version -p arti-bench        --bump minor
cargo set-version -p arti-testing      --bump minor
```
2022-06-24 12:00:22 -04:00
Ian Jackson 4831f9d38c Merge branch 'clippy' into 'main'
Fix clippy nightly again

See merge request tpo/core/arti!603
2022-06-24 14:13:58 +00:00
eta ec3e1f2ada Merge branch 'error_cleanup_2' into 'main'
Error refactoring: bytes, cert, proto.

See merge request tpo/core/arti!604
2022-06-24 13:01:42 +00:00
Nick Mathewson 38004a4f4d tor-proto: split and elaborate tor_bytes::Error instances
Some of these were for decoding particular objects (we now say
what kind of objects), and some were unrelated tor_cert errors that
for some reason we had shoved into a tor_bytes::Error.

There is now a separate tor_cert::CertError type, independent from
tor_cert's use of `tor_bytes::Error` for parsing errors.
2022-06-23 15:42:45 -04:00
Ian Jackson 2ed2fc4ac7 base64: Move some tests into a separate function, placating clippy 2022-06-23 19:21:55 +01:00
Ian Jackson 589c6e52bb Run maint/add_warning crates/*/src/{lib,main}.rs
Update all lint blocks
2022-06-23 19:15:42 +01:00
Ian Jackson 20e41c30fe base64: Add yet more test cases 2022-06-23 18:32:58 +01:00
Arturo Marquez b72bf50698
Add some more test cases for base64
These tests are borrowed from other parts of the `tor-netdoc`
crate.
2022-06-22 11:30:57 -05:00
Arturo Marquez 87ed48271a
Improve base64 tests
Request for changes: `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600#note_2816252`
2022-06-22 10:34:01 -05:00
Arturo Marquez 4333708384
Add link to upstream issue
As per request, here: `https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/600#note_2816252`
2022-06-22 09:55:11 -05:00
Arturo Marquez 2d92e9e218
Remove unused `base64` crate 2022-06-21 20:28:58 -05:00
Arturo Marquez 6536ca0f61
Replace `base64` crate with `base64ct` crate
Note: the `base64ct` crate rejects invalid characters when the
decoding is done on padded strings. However, the `FromStr` impl
for `B64` can have both padded **and** unpadded inputs, so all
inputs are now padded first, before decoding.
2022-06-21 20:02:33 -05:00
Nick Mathewson 1c5f540dc8 Add a configuration option for reachable_addrs
(This doesn't do anything yet.)
2022-06-17 08:47:57 -04:00
Nick Mathewson fb672dc688 NetDoc: Make AddrPortPattern implement serde traits
I'm using serde_with here to just re-use the Display and FromStr
implementations, since those are what has proven easier to type in
the past.
2022-06-17 08:47:57 -04:00
Nick Mathewson 19fa946fc7 Make AddrPortPattern and friends implement Eq and PartialEq 2022-06-17 08:46:16 -04:00
Nick Mathewson 0223c91b26 Merge branch 'high-level-features' into 'main'
Add "full" and "experimental" features to arti, arti-client, and below.

Closes #499

See merge request tpo/core/arti!584
2022-06-16 12:24:47 +00:00
Nick Mathewson bd9bd39ef3 Add one more "allow" to tor_netdoc::parse::macros.
Without this, clippy is error-free, but `cargo test` somehow gives a
warning.
2022-06-15 11:52:30 -04:00
Nick Mathewson 8a586a40fa Add "full" and "experimental" features to arti-client and below.
The "full" feature is a catch-all for all features, _except_:

   * Those that select a particular implementation (like
     tor-llcrypto/with-openssl) or build flag (like "static")
   * Those that are experimental or unstable (like "experimental-api")
   * Those that are testing-only.
2022-06-10 15:32:21 -04:00
Nick Mathewson 126bf7dace Netdoc tests: extract decode-base64-ignore-ws code. 2022-06-07 12:45:59 -04:00
Nick Mathewson d30899d387 microdesc: make sure we recover from an error in the final md.
(This is slightly different from recovering from errors in the
middle of a list of mds, since in this case we _can't_ advance to the
next md.)

Also, note that a given branch is probably not reachable.
2022-06-07 12:45:59 -04:00
Nick Mathewson 42d6d02fbe netdoc: test case for microdesc with no ed25519 id.
The "bad-id" microdescriptor is hand-edited based on one from a
Chutney network.
2022-06-07 12:45:57 -04:00
Nick Mathewson 48fff1d735 netdoc: test a couple of accessors for AuthCert. 2022-06-07 12:45:57 -04:00
Nick Mathewson 97c8c27514 Netdoc: test enforcement for items that mustn't take objects.
Found via coverage.
2022-06-07 12:45:57 -04:00
Nick Mathewson c5e56c734d netdoc: remove an unused method. 2022-06-07 12:45:57 -04:00
Nick Mathewson 41be108b51 netdoc: Test more accessors for tokenized documents. 2022-06-07 12:45:57 -04:00
Nick Mathewson 102600e1c7 Netdoc: add accessor to error for ParseErrorKind
The kind type was already public, but we didn't give the user any
way to get it.
2022-06-07 12:45:57 -04:00
Nick Mathewson 171aa5ea00 netdoc: tests for parsing UnvalidatedEdCert. 2022-06-07 12:45:57 -04:00
Nick Mathewson 9641d5ff59 Tests for netdoc RsaPublic type. 2022-06-07 12:45:57 -04:00
Nick Mathewson 07dc49a2dc Fix a copy-paste error in Ed25519 parsing tests.
We accidentally tried to validate (invalid) ed25519 keys
as curve25519 keys.
2022-06-01 08:32:09 -04:00
Nick Mathewson 3de2496303 Add test for parsing bad tor version with too many elements.
This is a coverage-driven test.
2022-06-01 08:32:09 -04:00
Nick Mathewson 3e693fa717 Add test for mutability of RelayFamily. 2022-06-01 08:32:09 -04:00
Nick Mathewson 526fd424f7 Tests for tor_netdoc::util::intern 2022-06-01 08:32:09 -04:00
Ian Jackson 4f42101554 lints: Add let_unit_value allow to all crates
From running add_warning, with manual picking of the right
hunks/lines.
2022-05-31 15:23:52 +01:00
Ian Jackson ba0843da4a lints: Add lint block delimiters to every crate
This was the result of:
  maint/add_warning crates/*/src/{lib,main}.rs
and then manually curating the results.
2022-05-31 13:00:31 +01:00
Ian Jackson eb49bc7f46 lints: Suppress unknown lints in a way that works on nightly too
This is ridiculous.
2022-05-31 13:00:21 +01:00
Orhun Parmaksız bfd41ddb5f
Lexically sort Cargo.toml dependencies
Utilize cargo-sort: https://github.com/DevinR528/cargo-sort

Signed-off-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2022-05-28 20:05:51 +03:00
Ian Jackson 0173fce2e9 tor-netdoc: Allow suppressing unknown lints
We want to supress the unused_macro_rules lint in one place but it's
new in Nightly and this triggers yet another lint.
2022-05-27 17:36:54 +01:00
Ian Jackson 1f067c0237 tor-netdoc: Suppress new "unused_macro_rules" lint in one place
The compiler can apparently tell that we aren't generating compile
errors!  Also that we're not yet using a feature provided here.

(New lint in currently Nightly.)
2022-05-27 17:36:52 +01:00
Nick Mathewson 4326aa1de9 Regenerate version bump from previous commit.
This commit was made by reverting the previous commit, then
re-running the script I used to generate it.  In theory there should
be no semantic changes: only changes due to improved formatting from
cargo edit.
2022-05-27 10:18:52 -04:00
Nick Mathewson b232365a75 Semantic version changes for Arti 0.4.0 release
I followed the following procedure to make these changes:

* I used maint/changed_crates to find out which crates had changed
  since 0.3.0.
* I used grep and maint/list_crates to sort those crates in
  topological (dependency) order.
* I looked through semver_status to find which crates were listed as
  having semver-relevant changes (new APIs and breaking changes).
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no changes.  For those crates, I incremented their patch-level
  version _without_ changing the version that other crates depend on.
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no obvious breaking changes.
* I treated all crates that depend on `arti` and/or `arti-client` as
  having breaking changes.
* I identified crates that depend on crates that have changed, even
  if they have not changed themselves, and identified them as having
  a non-breaking change.
* For all of the crates, I used `cargo set-version -p $CRATE --bump
  $STATUS` (where `STATUS` is `patch` or `minor`) to update the
  versions, and the depended-upon versions.
2022-05-27 09:01:20 -04:00
Ian Jackson 85faa1c0f6 Merge branch 'upgrades-20220523' into 'main'
Update to newer sanitize-filename and tinystr.

See merge request tpo/core/arti!523
2022-05-24 13:22:01 +00:00
Nick Mathewson c27b3cb701 Update to newer sanitize-filename and tinystr. 2022-05-23 16:02:50 -04:00
Nick Mathewson 546ae3000e Resolve the new `derive_partial_eq_without_eq` lint.
It's a little overzealous sometimes, but it's mostly to the good.
2022-05-23 12:55:37 -04:00
Dimitris Apostolou 58dc576887
Fix typo 2022-05-14 20:02:53 +03:00
Nick Mathewson 12d1752ad5 tor-netdoc: Add a Lifetime::valid_at method. 2022-05-11 12:11:17 -04:00
Nick Mathewson 3b0336e841 netdoc: add a new type for Nicknames
Relay nicknames are always between 1 and 19 characters long, and
they're always ASCII: That means that storing them in a [u8;19] will
always be possible, and always use less resources than storing them
in a String.

Fortunately, the tinystr crate already helps us with this kind of
thing.
2022-05-09 15:59:38 -04:00