Commit Graph

461 Commits

Author SHA1 Message Date
Nick Mathewson fbffd3168c Even more clarifying comments. 2023-02-07 09:02:15 -05:00
Nick Mathewson 328535855a netdoc: Try to add a bunch of clarifying documentation.
In the process I found a couple of keys without identifiers in the
spec.
2023-02-07 09:02:15 -05:00
Nick Mathewson 6954c6b488 netdoc: Use Signature::from to construct ed25519 sigs. 2023-02-07 09:02:15 -05:00
Nick Mathewson 4c24f8e8a2 netdoc: Clear up a few typos in hsdesc comments and strings. 2023-02-07 09:02:15 -05:00
Nick Mathewson d699742400 netdoc: Implement onion service descriptor parsers. 2023-02-07 09:02:15 -05:00
Nick Mathewson 23757d90c1 netdoc: Parse the inner layer of an onion service descriptor.
There are some places where I note certificates which are not
currently validated, because there is no cryptographic point in
doing so.  We should either document that this is okay, or validate
the certificates anyway.

This code might benefit from refactoring to make it prettier.
2023-02-07 09:02:15 -05:00
Nick Mathewson 6817f61641 netdoc: Add a workaround for C Tor's lack of mid-layer NL
It turns out that C Tor doesn't add a newline at the end of the
middle layer of an onion service descriptor.  I've made a spec MR
(torspec!109) to document this: here, it's time to work around the
issue.
2023-02-07 09:02:15 -05:00
Nick Mathewson 4be4d178fa netdoc: Parse the middle layer of a hsdesc, and decrypt it. 2023-02-07 09:02:15 -05:00
Nick Mathewson 321c8582ce netdoc: Use correct size for descriptor encryption cookie 2023-02-07 09:02:15 -05:00
Nick Mathewson d8849f583e netdoc: move test descriptor to a higher level test module
We're going to make use of it in all of our tests, so we may as well
expose it to them from hsdesc::test.
2023-02-07 09:02:15 -05:00
Nick Mathewson 02fa682bc0 netdoc: implement onion service descryptor encryption
This is tested via a round-trip check, and via a successful
decryption of our example descriptor's outer layer.
2023-02-07 09:02:13 -05:00
Nick Mathewson 6c4e9c8f1d netdoc: Parser for outer layer of onion service descriptors. 2023-02-07 09:00:19 -05:00
Nick Mathewson d35e8a751d netdoc: Add an example onion service descriptor to test our parsing.
I generated this using C tor (latest main) and a Chutney network
about a week ago.

The subcredential is:
   78210A0D2C72BB7A0CAF606BCD938B9A3696894FDDDBC3B87D424753A7E3DF37
The HS_blind_id is:
   43CC0D62FC6252F578705CA645A46109E265290343B1137E90189744B20B3F2D
2023-02-07 09:00:19 -05:00
Nick Mathewson 0f1cfc308a netdoc: Derive Debug and Clone on HsDesc and its kin. 2023-02-07 09:00:19 -05:00
Nick Mathewson 73199ebf68 netdoc: Require that unrecognized tokens be handled explicitly.
Now we require that, for all `SectionRules`, either the caller say
how to handle unrecognized tokens (using `.add(UNRECOGNIZED...)`),
or that they explicitly reject unrecognized tokens (using
`reject_unrecognized`()`.)

This solution uses an assert!() rather than an Error to indicate
failure.  I say that's fine, since
  1. This is a crate-internal API.
  2. We never dynamically construct SectionRules according to
     different behavior: they are always prefabricated in a fixed
     code block.  Thus, if we test a parser at all, we will make
     sure that its SectionRules are well-formed.

I considered and explicitly rejected a solution where the builder
had to be finalized with separate methods `build_strict()` or
`build_tolerant()`: It's too easy IMO for the caller to forget what
these call means.

Prevents further recurrences of #752.

Closes #752.
2023-02-03 11:33:30 -05:00
Nick Mathewson 13d5452e2e netdoc: Switch SectionRules building to use a Buidler pattern.
No new behavior yet.
2023-02-03 11:14:00 -05:00
Nick Mathewson 266c61f721 Add a rule to handle UNRECOGNIZED in AuthCert.
This fixes an instance of bug#752.  Previously, we would reject any
AuthCert that contained an unexpected keyword.  (Fortunately, this
data format does not change very often.)
2023-02-03 10:53:23 -05:00
Ian Jackson 5bca38acc5 tor-netdoc: Suppress a cfg-dependent dead code warning
This is dead code when
  cargo +stable clippy -p tor-netdir --all-features --all-targets
2023-02-01 18:46:54 +00:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Nick Mathewson 2490b3cdc6 Use derive_more on SharedRandVal
This may be temporary if we wind up converting to CtByteArray,
but for now it's good to be terse.
2023-01-28 12:43:08 -05:00
Ian Jackson a51c76178e Several suggestions on gitlab. 2023-01-28 12:43:08 -05:00
Nick Mathewson 9f3e6783ca netdoc: Add Eq and a note to SharedRandVal. 2023-01-28 12:12:17 -05:00
Nick Mathewson 790b38eec8 netdoc: Add SRV accessors.
These are deliberately unsophisticated accessors, in that they return Option<>
rather than filling in missing values with the documented
fallbacks. It seems better to leave a way to distinguish the absent
case in the API.
2023-01-28 12:12:17 -05:00
Nick Mathewson c1ced84239 netdoc: Add a timestamp to SRVs per prop#342.
This breaks some experimental APIs, but since they are experimental
no semver note is needed.
2023-01-28 12:12:17 -05:00
Nick Mathewson 8ce447b7e2 netdoc: Add Iso8601 time _with_ a "T" as an argument type. 2023-01-28 12:12:17 -05:00
Dimitris Apostolou 3da36c5c8b
Fix typos 2023-01-28 01:31:10 +02:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson ed74c62931 Elide a bunch of lifetimes.
Clippy now warns about these; I'm not sure how these warnings snuck
up on us.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
This warning kind of snuck up on us! (See #748)  For now, let's
disable it.  (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)

Closes #748.
2023-01-27 08:27:47 -05:00
Ian Jackson 92ba020534 Add missing docsrs attribute 2023-01-24 16:19:05 +00:00
Ian Jackson 15a543d738 netdoc builder: Add two TODOs, prompted by testing experience 2023-01-24 16:15:17 +00:00
Ian Jackson be1cd7789d netdoc builder test: Make a bigger dummy document and test reparsing 2023-01-24 16:15:17 +00:00
Ian Jackson eb3b261595 netdoc builder: Implement object() and add one test case 2023-01-24 16:15:17 +00:00
Ian Jackson 4f0d17d96d netdoc-builder: Initial test case (no object yet) 2023-01-24 16:15:17 +00:00
Ian Jackson 066eb12f50 netdoc-builder: Provide new() method 2023-01-24 16:15:17 +00:00
Ian Jackson e989871a7b netdoc-builder: Implement ItemArgument for more needed types 2023-01-24 16:15:17 +00:00
Ian Jackson 94fec1e12c netdoc-builder: Remove some obsolete comments 2023-01-24 16:15:17 +00:00
Ian Jackson 16c4fee4b8 netdoc-builder: Move example into implementation doc comment
Not actually tested yet
2023-01-24 16:15:17 +00:00
Ian Jackson 8f725a19f8 netdoc-builder: Implement most of the internal general doc builder 2023-01-24 16:15:17 +00:00
Ian Jackson 22cf060426 netdoc-builder api: Clarify docs for object() 2023-01-24 16:15:17 +00:00
Ian Jackson c7e816d263 netdoc-builder api: Introduce ItemArgument trait 2023-01-24 16:15:17 +00:00
Ian Jackson eac7befc87 netdoc-builder api: Have .item() return ItemBuilder
This was a slip in the design doc.
2023-01-24 16:15:17 +00:00
Ian Jackson 8c8ff4948f netdoc-builder api: Abolish `K` generic on ItemEncoder
We're going to eagerly encode the keyword, so this will be easy.
Removing the generic simplifies the API.
2023-01-24 16:15:17 +00:00
Ian Jackson 669a399c46 netdoc-builder api: Don't promise to check args_raw_string value 2023-01-24 16:15:17 +00:00
Ian Jackson 2bc7a371b4 netdoc-builder api: Make ItemEncoder methods consume and return self
This will actually make the pattern in the example work.

The mentioned `ItemArgument` trait will arrive soon.
2023-01-24 16:15:17 +00:00
Ian Jackson 5fccbce160 netdoc-builder api: Move internal API into actual code file (fmt) 2023-01-24 16:15:17 +00:00
Ian Jackson e971d1ad59 netdoc-builder api: Move internal API into actual code file
Motion, plus the bare minimum needed to make it compile.
2023-01-24 16:15:17 +00:00
Ian Jackson f735a128bb tor-netdoc: tokenize: Provide BASE64_PEM_MAX_LINE
We'll use this in the netdoc builder, but it naturally lives here.
2023-01-24 16:15:17 +00:00
Ian Jackson c8ac951cf5 tor-netdoc: tokenize: Rename to tag_keywords_ok, document, expose
Rename from _keyword_, since this actually checks the *multiple*
keywords that can appear in an object's BEGIN line.

Make this clear in the doc comment.

Expose it for use by the netdoc builder.
2023-01-24 16:15:17 +00:00
Ian Jackson a8ab0a5f46 tor-netdoc: tokenize: crate-Expose object::BEGIN_STR etc.
The document builder wants these too.
2023-01-24 16:15:17 +00:00
Ian Jackson 5bd54f3701 tor-netdoc: Make AuthCertKwd pub(crate)
For now, this will be useful in a test.
2023-01-24 16:15:17 +00:00
Ian Jackson 4e6f5b7ff3 Do not .gitignore crates/*/fuzz/corpus
These are symlinks which are actually checked in.  They should not be
ignored.  (This caused trouble for some of my privsep tooling...)
2023-01-20 17:29:00 +00:00
Nick Mathewson 2c41321710 Netdoc: Refactor SharedRandVal.
SharedRandVal now holds only the 32-byte random value itself; the
"number of commits" field is in SharedRandStatus.

This commit also makes the SharedRandVal be exactly 32 bytes, since
we've set it to that value in the spec.
2023-01-11 09:04:12 -05:00
Nick Mathewson eba937e54c netdoc: Outline some basic types for encoding HsDescs. 2023-01-06 13:03:50 -05:00
Nick Mathewson e650e07cd4 netdoc: note some changes we will have to make to srv 2023-01-06 13:03:50 -05:00
eta 118050e54c Merge branch 'test-lints' into 'main'
Add test lint blocks to all "mod test"

See merge request tpo/core/arti!937
2023-01-06 17:16:09 +00:00
Neel Chauhan a180f911bd Use parse_rfc3339() in the tor-netdoc crate 2022-12-16 12:56:00 -08:00
Ian Jackson 125a455bdc test lint blocks: Add many many automatically
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
2022-12-12 18:00:30 +00:00
Ian Jackson baf78361e8 test lint blocks: Do some semi-manually
This is the hunks from running the rune in maint/adhoc-add-lint-blocks
but which require some subsequent manual fixup: usually, deleting
now-superfluous outer allows, but in some cases manually putting back
lints that the adhoc script deleted.
2022-12-12 18:00:29 +00:00
coral 25f113b8b3 Tackling issue #663 (Use humantime in tests) 2022-12-12 17:41:22 +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 d78295929b Merge branch 'more_netdoc_tests' into 'main'
tor-netdoc: More tests for routerdesc accessors and parsing.

See merge request tpo/core/arti!870
2022-11-29 11:11:47 +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 cb3a790084 netdoc: Add a test for routerdesc family parsing. 2022-11-17 14:40:15 -05:00
Nick Mathewson 5655b95b54 netdoc: Correct and test some tricky routerdesc errors
These required hex-editing identity certificates :P
2022-11-17 14:35:40 -05:00
Nick Mathewson c0bc7bb11e netdoc: Add tests for routerdesc accessors. 2022-11-17 13:43:32 -05:00
Nick Mathewson 9f53a79ddf Netdoc: use a different desc in tests.
This is from Akka, which ahf runs.
2022-11-17 13:25:05 -05:00
Ian Jackson b46d1600e7 Merge branch 'real_netdoc_pos' into 'main'
Replace `Option<Pos>` with `Pos` in `ParseError`.

Closes #640

See merge request tpo/core/arti!859
2022-11-16 11:50:20 +00:00
Nick Mathewson 7a42cb0e45 Remove a `TODO pt-client` in netdoc.
This issue is now torspec!94.
2022-11-15 17:19:26 -05:00
Nick Mathewson 39615516fd Replace `Option<Pos>` with `Pos` in `ParseError`.
We already have `Pos::Unknown` for an error at an unknown
location and `Pos::None` for an error where no location is
sensible. There's no reason to have an additional `Option` here.

Additionally, the use of `Option` gave us a bug where our old
`ParseError::at_pos()` method didn't actually set the position
unless the position was already set.  That's not what we want!

Fixes #640.

Finally, we have to fix a test that was a bit broken because it was
working around #640.
2022-11-15 16:58:23 -05:00
Nick Mathewson 2bd422663e Resolve a dead-code warning. 2022-11-15 13:53:14 -05:00
Nick Mathewson 89be046466 netdoc: Allow empty lines at the end of a router descriptor. 2022-11-15 11:27:43 -05:00
Nick Mathewson bc7780bffd tor-netdoc: Add a new ErrorKind for EmptyLine.
Empty lines were previously reported as BadKeyword, which is
confusing.
2022-11-15 11:27:43 -05:00
Nick Mathewson 9c9f9bbd25 Merge branch 'guardmgr-todo-misc' into 'main'
Resolve most "TODO pt-client" comments in GuardMgr

See merge request tpo/core/arti!840
2022-11-10 17:50:34 +00:00
Nick Mathewson dcfb4d0956 RouterDesc: Add an or_ports method. 2022-11-10 12:11:28 -05:00
Nick Mathewson 34ae02e75f Upgrade to serde_with 2, phf 0.11. Closes #526. 2022-11-10 11:04:18 -05:00
Nick Mathewson 2c13a78c57 Upgrade to tinystr 0.7. Closes #591. 2022-11-10 10:57:33 -05:00
Nick Mathewson 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
eta 53f62eb8be Merge branch 'store-yak-misc' into 'main'
Small misc yaks for bridge descriptor persistence

See merge request tpo/core/arti!828
2022-11-08 14:28:14 +00:00
Dimitris Apostolou 9c7d1802f5
Fix typos 2022-11-06 06:51:58 +02:00
Ian Jackson f3957a50b6 tor-netdoc: RouterDesc: Add published accessor
The bridge descriptor manager is going to want this.
2022-11-04 19:01:24 +00:00
Nick Mathewson 932fe48eaf Run add_warnings. 2022-11-03 11:06:02 -04:00
eta c77cecd5b3 Merge branch 'edition-2021' into 'main'
set all crate edition to 2021

See merge request tpo/core/arti!822
2022-11-03 14:39:24 +00:00
Ian Jackson 48f48841e1 Require derive_more 0.99.3
0.99.[012] have a bug https://github.com/JelteF/derive_more/issues/114
which makes the Deref derive for bridgedesc::StateGuard not work
and therefore breaks minimal-versions CI.

It seems simpler to require the newer version everywhere.
2022-11-03 11:37:23 +00:00
trinity-1686a d29f38603d set all crate edition to 2021 2022-11-01 00:17:33 +01:00
Nick Mathewson 8f267ba166 Fix some rustdoc errors.
In addition to the usual "You named that method wrong!" errors, we
have a new rustdoc error that complains about bogus "HTML tags" that
are actually unquoted usage of types like `Result<Foo>`.
2022-10-13 09:08:46 -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 acb6288621 netdoc: Add accessors for protocols and ntor key.
These are needed to actually be able to build circuits through
a bridge.
2022-10-04 17:49:32 -04:00
Nick Mathewson 6f0d974cbe tor-netdoc: Add relay ID accessors for RouterDesc.
To implement a reasonable RsaIdentity accessor, we have to
store the RsaIdentity in the RouterDesc, or else we'd have to
recalculate it using SHA1 and DER every time.

The Ed25519 identity is hidden inside the identity cert, but it's
safe to get a reference to it.
2022-10-04 17:49:32 -04:00
Nick Mathewson 128fb76c73 Upgrade all fuzzers to newer libfuzzer-sys version. 2022-10-03 14:35:34 -04:00
Nick Mathewson 88a06225b9 Remove semver.md files now that arti 1.0.1 is out. 2022-10-03 14:16:56 -04:00
Nick Mathewson 388e0cbab5 Bump crates that have had backward compatible API changes. 2022-10-03 09:52:34 -04:00
Nick Mathewson 6a04188d59 Work around a new nightly clippy warning
The warning `clippy::bool_to_int_with_if` is meant to shout at you
when you say `if x { 1 } else { 0 }` and instead suggest that you
say `inttype::from(x)`.

I agreed with this for the case in tor-cert, where we are literally
converting a boolean into a flag.

I don't agree with this in tor-netdoc, where we are using a boolean
to decide how many fields to skip in a given document format.  So
for this case, I decided to clean up the code a little by renaming
"skip" to "n_skip", and changing the boolean to use an enum instead.
2022-09-30 09:00:42 -04:00
Nick Mathewson 571e7f9556 Make RouterDesc implement Clone and Debug.
Their omission was an oversight.
2022-09-26 11:23:21 -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
trinity-1686a ca99e9f635 add feature annotation to fields made visible through visible::StructFields 2022-08-24 18:22:41 +02:00
trinity-1686a 426a59b2ba add feature annotation not added by doc_auto_cfg 2022-08-24 18:22:41 +02:00
trinity-1686a 7f939fa480 enable doc_auto_cfg feature on every crate when documenting for docs.rs 2022-08-24 18:22:41 +02:00
Ian Jackson cd8d41fd2e tor-netdoc: NetParams: impl FromIterator
Otherwise a caller who has a set of parameters must open-code the
loop.
2022-08-16 18:43:23 +01:00
Nick Mathewson 859ae4acd0 Bump patch versions on crates that have new APIs.
Do _not_ bump the dependency versions on crates that have had no
changes since arti 0.0.5, since those crates do not depend on the
new APIs.

```
cargo set-version -p tor-basic-utils   --bump patch
cargo set-version -p tor-llcrypto      --bump patch
git restore crates/tor-checkable
git restore crates/tor-consdiff
git restore crates/tor-rtmock
```
2022-08-01 09:56:29 -04:00
Nick Mathewson 511cb46997 Bump minor version on crates with deps with breaking changes.
This performs the transitive closure of the last operation:
everything that depends on a crate with a breaking change gets the
version which it depends on bumped.

```
cargo set-version -p tor-proto         --bump minor
cargo set-version -p tor-netdoc        --bump minor
cargo set-version -p arti-hyper        --bump minor
cargo set-version -p arti-bench        --bump minor
cargo set-version -p arti-testing      --bump minor
cargo set-version -p tor-config        --bump minor
```
2022-08-01 09:49:13 -04:00
Nick Mathewson f5dcb98f06 Bump minor versions on all crates that have had breaking changes.
Done with these commands:

```
cargo set-version -p fs-mistrust       --bump minor
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-linkspec      --bump minor
cargo set-version -p tor-cell          --bump minor
cargo set-version -p tor-netdir        --bump minor
cargo set-version -p tor-persist       --bump minor
cargo set-version -p tor-chanmgr       --bump minor
cargo set-version -p tor-guardmgr      --bump minor
cargo set-version -p tor-circmgr       --bump minor
cargo set-version -p tor-dirclient     --bump minor
cargo set-version -p tor-dirmgr        --bump minor
cargo set-version -p arti-client       --bump minor
cargo set-version -p arti              --bump minor
```
2022-08-01 09:43:09 -04:00
trinity-1686a eed8032dbd fix nighly clippy 2022-07-23 20:25:33 +02:00
trinity-1686a 8c28622ecb change usage of PublicKey to Ed25519 in tor-cert
and propagate to other affected crates
2022-07-23 20:07:25 +02:00
trinity-1686a 8def416144 change check_key to take a Option<&_> instead of &Option<_> 2022-07-23 18:38:31 +02:00
Nick Mathewson cf02d9990c Also downgrade serde_with: Version 2.0 requires Rust 1.60 2022-07-20 11:45:19 -04:00
Nick Mathewson 3ad312320e Downgrade phf back to 0.10
It turns out that phf 0.11 depends on Rust 1.60, which is above our
MSRV.
2022-07-20 10:48:28 -04:00
Nick Mathewson 131d880c7f Upgrade to latest phf, serde_with, serial_test. 2022-07-19 16:49:44 -04:00
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
Ian Jackson cc99efb72a NetParams: Document its role as a validated config parameter 2022-05-09 15:35:50 +01:00
Nick Mathewson 7b93091f57 Bump the version of every* crate to 0.3.0
* Except for safelog and fs-mistrust, which are new.
2022-05-06 10:03:15 -04:00
Samanta Navarro c53818d496 Fix grammar and typos 2022-04-27 13:52:13 +01:00
Nick Mathewson 2f6bc6bdc4 squash! Bump every crate's edition to 2021.
Remove all `use` statements for `TryFrom` and `TryInto`.  These are
now redundant in Rust 2021.
2022-04-25 13:06:26 -04:00
Nick Mathewson b60b0a266a Bump every crate's edition to 2021.
This is an automated change made with a perl one-liner and verified
with grep -L and grep -l.

Some warnings are introduced with this change; they will be removed
in subsequent commits.

See arti#208 for older discussion on this issue.
2022-04-25 13:05:31 -04:00
Nick Mathewson ca05b0904c Add 'rust-version = "1.56"' to every Cargo.toml file.
This change was made automatically with a perl one-liner, and
confirmed with `grep -L`.

The `rust-version` field itself was introduced in 1.56.0.
2022-04-25 13:04:31 -04:00
Nick Mathewson 0069fd2206 Reformat all not-yet-reformatted Cargo.toml files.
There are no semantic changes here; only formatting.  This is in
preparation for other changes (wrt MSRV and edition)
2022-04-25 13:04:31 -04:00
Nick Mathewson 5b2fc118df Bump all arti*, tor* crates to 0.2.0
Not all of these strictly need to be bumped to 0.2.0; many could go
to 0.1.1 instead.  But since everything at the tor-rtcompat and
higher layers has had breaking API changes, it seems not so useful
to distinguish.  (It seems unlikely that anybody at this stage is
depending on e.g. tor-protover but not arti-client.)
2022-04-01 09:15:18 -04:00
Nick Mathewson 0725e388a5 Re-order attributes so that we can build with Rust 1.53. 2022-03-31 11:11:02 -04:00
Ian Jackson 68b614ade1 Typo fix. 2022-03-31 14:34:11 +00:00
Nick Mathewson b1b7ef00a0 tor-netdoc: Conditionally expose document fields.
This commit uses the `visibility` and `visible` crates to
conditionally make certain structs and their fields public
(respectively).  This is incredibly dangerous to use for anything
besides testing, and I've tried to write the documentation for the
feature accordingly.
2022-03-31 09:27:27 -04:00
Nick Mathewson 700e491813 Remove allow(clippy::disallowed_methods) lint. 2022-03-30 08:55:58 -04:00
eta fd081742fa Merge branch 'no-system-time' into 'main'
Don't use SystemTime::now()

Closes #306

See merge request tpo/core/arti!365
2022-03-30 12:44:25 +00:00
Ian Jackson 8d54c0f073 Change type of TorClientConfig::override_net_params
Now we use NetParams.  That implies making its constructor public,
which I think it fine.

This is related to #413 but is far from completing that ticket.
2022-03-16 19:30:59 +00:00
Ian Jackson 7564fabd68 Replace a match with some as_ref and as
The match was doing a deref coercion.

Found by current nightly's needless_match (whose suggestion doesn't
compile, https://github.com/rust-lang/rust-clippy/issues/8551 )
2022-03-16 14:41:04 +00:00
Nick Mathewson 8f430fd58d Merge branch 'main' into 'intern-more'
# Conflicts:
#   doc/semver_status.md
2022-03-14 14:19:44 +00:00
eta 258e42ad3e Merge branch 'slice-from-ref' into 'main'
Simpify tor-netdoc TokVal

See merge request tpo/core/arti!404
2022-03-14 13:14:05 +00:00
Nick Mathewson a98ae2a1f0 Canonicalize and intern protover lines on descriptors
This should save around 1MB per consensus, since every relay has a
'protocols' lines, but there are only a few distinct possibilities
for such a line.

Closes #385.
2022-03-11 16:56:12 -05:00
Nick Mathewson 16f1bda324 Canonicalize and intern family representations to save memory.
This should save 1-3 MB of ram on each running arti client.

Closes #384. See also tor#27359 and proposal 298.
2022-03-11 16:54:33 -05:00
Nick Mathewson 718a1ee340 Add a more generic implementation of intern-by-ref 2022-03-11 14:03:29 -05:00
Nick Mathewson 6f42c79654 netdoc: Call shrink_to_fit() when we're done parsing rs sections
(Once we're done parsing these, the vector will never get any
longer.)
2022-03-11 14:03:29 -05:00
Nick Mathewson 1c6c05fac3 netdoc: allocate no extra space for RouterStatus addresses.
This should save around 181K of heap on a current directory.
2022-03-11 14:03:29 -05:00
Nick Mathewson e7c584f1b3 netdoc: Make versions smaller in GenericRouterStatus
When the version is a Tor version, we can just parse it; otherwise,
we can intern it.  This shrinks GenericRouterStatus and avoids a lot
of extra help allocations.
2022-03-11 14:03:29 -05:00
Nick Mathewson 3c9093f294 tor-netdoc: reformat cargo.toml.
This is the default vscode format, and seems popular elsewhere.
This commit does nothing but reformat.
2022-03-11 14:03:29 -05:00
Nick Mathewson da82c76399 tor-netdoc: Remove unused or_port field from RS.
Part of #387
2022-03-11 14:03:29 -05:00
Ian Jackson 888eea47b3 tor-netdoc: Actually, make TokVal be a Vec
This enum was otiose: its set of valid values is precisely those of a
Vec.  (Indeed what would TokVal::Multi(vec![]) have meant?)
2022-03-11 18:42:01 +00:00
Ian Jackson 9a7783a230 Remove a pointless slice
std::slice::from_ref exists.  Spotted while reviewing !400
2022-03-11 18:24:03 +00:00
Christian Grigis 335af4ac30
Add methods to `UnverifiedConsensus` 2022-03-10 11:29:58 +01:00
Nick Mathewson caf372ac0f tor-netdoc: Use RsaIdentity::from_hex() in critical path.
This commit changes the main parsing code for RsaIdentity in
tor-netdoc, and .

Previously, parse_hex_ident was something like 10% of our startup
CPU time; now it's only like ~2%.  (Still not perfect, but way
better.)

Closes #377.
2022-03-04 09:05:04 -05:00
eta e9f8ddfb9c Fix introduced junk in doc comment. 2022-03-04 10:56:40 +00:00
Ian Jackson 535e4ff118 Replace manual Default and new with std derive in tor-netdoc 2022-03-02 18:01:08 +00:00
Nick Mathewson 83c8b11c2c Merge branch 'clippy-allow-arc-clone' into 'main'
Disable clippy::clone_on_ref_ptr

See merge request tpo/core/arti!352
2022-03-01 20:38:05 +00:00
Nick Mathewson e8e9791a97 Bump all crates to 0.1.0 2022-03-01 08:59:34 -05:00
trinity-1686a f06b256010 use wallclock where possible in tests 2022-02-26 00:33:44 +01:00
Ian Jackson afb50fe735 Disable clippy::clone_on_ref_ptr
This lint is IMO inherently ill-conceived.

I have looked for the reasons why this might be thought to be a good
idea and there were basically two (and they are sort of contradictory):

I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact
    that only the pointer is being cloned, not the underlying data."

This is the wording from
  https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr

It is a bit terse; we are left to infer why it is a bad idea to
obscure this fact.  It seems to me that if it is bad to obscure some
fact, that must be because the fact is a hazard.  But why would it be
a hazard to not copy the underlying data ?

In other languages, faliing to copy the underlying data is a serious
correctness hazard.  There is a whose class of bugs where things were
not copied, and then mutated and/or reused in multiple places in ways
that were not what the programmer intended.  In my experience, this is
a very common bug when writing Python and Javascript.  I'm told it's
common in golang too.

But in Rust this bug is much much harder to write.  The data inside an
Arc is immutable.  To have this bug you'd have use interior mutability
- ie mess around with Mutex or RefCell.  That provides a good barrier
to these kind of accidents.

II. "The reason for writing Rc::clone and Arc::clone [is] to make it
     clear that only the pointer is being cloned, as opposed to the
     underlying data. The former is always fast, while the latter can
     be very expensive depending on what is being cloned."

This is the reasoning found here
  https://github.com/rust-lang/rust-clippy/issues/2048

This is saying that *not* using Arc::clone is hazardous.
Specifically, that a deep clone is a performance hazard.

But for this argument, the lint is precisely backwards.  It's linting
the "good" case and asking for it to be written in a more explicit
way; while the supposedly bad case can be written conveniently.

Also, many objects (in our codebase, and in all the libraries we use)
that are Clone are in fact simply handles.  They contain Arc(s) (or
similar) and are cheap to clone.  Indeed, that is the usual case.

It does not make sense to distinguish in the syntax we use to clone
such a handle, whether the handle is a transparent Arc, or an opaque
struct containing one or more other handles.

Forcing Arc::clone to be written as such makes for code churn when a
type is changed from Arc<Something> to Something: Clone, or vice
versa.
2022-02-24 18:15:44 +00:00
Nick Mathewson 7c7bf2bd03 Fix a rustdoc error. 2022-02-15 13:46:58 -05:00
Nick Mathewson 6bd21d4372 Refactor tor-netdoc a bit more, to use Bug right. 2022-02-15 10:22:38 -05:00
Nick Mathewson 13f39ed896 Minimal compilation fix: InternalError=>Bug
This is a followup for !314 and !310 to fix compilation on main.
2022-02-15 10:13:08 -05:00
Nick Mathewson 7b6a7a57d3 Merge branch 'doc-errors' into 'main'
Refactor errors in tor-netdoc

See merge request tpo/core/arti!314
2022-02-15 15:09:48 +00:00
eta cb7f068c3b Typo fix from@eta 2022-02-15 14:34:59 +00:00
Nick Mathewson b6d23c36be Refactor tor_netdoc::Error
This error type doesn't impement HasKind, since the kind will depend
on context.

However, the existing implementation was pretty messy and inconsistent:
Some errors had positions, some didn't.
Some took messages as str, some as String.
Some had internal errors that were somewhat orthogonal to their actual
types.

This commit refactors tor_netdoc::Error to use a ParseErrorKind, and
adds a set of convenience functions to add positions and
messages to the errors that need them.
2022-02-14 13:08:28 -05:00
Nick Mathewson b27c51d3a2 netdoc: Make doc-build errors a separate type
Every other case of tor_netdoc::Error means a parse failure.  This one,
though, means a failure to construct  a document.
2022-02-14 10:46:04 -05:00
Nick Mathewson 61867613a2 netdoc: remove Error::Untimely.
Nothing creates this.
2022-02-14 10:28:58 -05:00
Nick Mathewson 1cecc7e45a Change deny(clippy::all) to warn(clippy::all).
Closes #338.
2022-02-14 09:24:06 -05:00
Nick Mathewson 01d9937308 Bump the patch version of every crate that changed since 0.0.3 2022-01-31 10:30:52 -05:00
Ian Jackson 5e16a52e1c clippy: Suppress a warning 2022-01-19 17:12:26 +00:00
Nick Mathewson 7d3482ca1a Bump all crate versions to 0.0.3. 2022-01-11 09:40:32 -05:00
Nick Mathewson 4841b50c9f Minimize the required version for each dependency.
I found these versions empirically, by using the following process:

First, I used `cargo tree --depth 1 --kind all` to get a list of
every immediate dependency we had.

Then, I used `cargo upgrade --workspace package@version` to change
each dependency to the earliest version with which (in theory) the
current version is semver-compatible.  IOW, if the current version
was 3.2.3, I picked "3".  If the current version was 0.12.8, I
picked "0.12".

Then, I used `cargo +nightly upgrade -Z minimal-versions` to
downgrade Cargo.lock to the minimal listed version for each
dependency.  (I had to override a few packages; see .gitlab-ci.yml
for details).

Finally, I repeatedly increased the version of each of our
dependencies until our code compiled and the tests passed.  Here's
what I found that we need:

anyhow >= 1.0.5: Earlier versions break our hyper example.

async-broadcast >= 0.3.2: Earlier versions fail our tests.

async-compression 0.3.5: Earlier versions handled futures and tokio
    differently.

async-trait >= 0.1.2: Earlier versions are too buggy to compile our
    code.

clap 2.33.0: For Arg::default_value_os().

coarsetime >= 0.1.20: exposed as_ticks() function.

curve25519-dalek >= 3.2: For is_identity().

generic-array 0.14.3: Earlier versions don't implement
    From<&[T; 32]>

httparse >= 1.2: Earlier versions didn't implement Error.

itertools at 0.10.1: For at_most_once.

rusqlite >= 0.26.3: for backward compatibility with older rustc.

serde 1.0.103: Older versions break our code.

serde_json >= 1.0.50: Since we need its Value type to implement Eq.

shellexpand >= 2.1: To avoid a broken dirs crate version.

tokio >= 1.4: For Handle::block_on().

tracing >= 0.1.18: Previously, tracing_core and tracing had separate
    LevelFilter types.

typenum >= 1.12: Compatibility with rust-crypto crates

x25519-dalek >= 1.2.0: For was_contributory().

Closes #275.
2022-01-07 19:08:58 -05:00
Daniel Eades 592642a9e6 extend lints to include 'clippy::all' 2021-12-28 20:15:40 +00:00
eta 0cdf65c256 Merge branch 'refactor/must-use-self' into 'main'
address clippy's latest lint

See merge request tpo/core/arti!205
2021-12-20 18:38:18 +00:00
Nick Mathewson a2afb29806 Change an UTF-8 XXX to a TODO.
We're assuming that prop285 is accepted in some form.
2021-12-20 09:54:41 -05:00
Nick Mathewson 8cf143217e tor-netdoc: Change an XXX to a TODO.
Our behavior in handling not-yet-valid router descriptors doesn't match
the C Tor implementation, but it's not a big deal:
we don't currently use router descriptors at all.
2021-12-20 09:46:56 -05:00
Nick Mathewson 6299ca70b4 tor-netdoc: Use a more correct error type
If we fail to convert a curve25519 key to an ed25519 key for checking
the onion-key crosscert, don't call that an internal error: it means
that something is wrong with the provided ntor key.
2021-12-20 08:58:30 -05:00
Nick Mathewson 92e53bff62 Remove an XXXX about ed25519 signatures.
As of tor-spec commit 01122c5bd7d2f0f, the spec is no longer ambiguous
on this point.
2021-12-20 08:53:42 -05:00
Daniel Eades 9b51a52b53 address clippy's latest lint 2021-12-20 09:46:41 +00:00
Neel Chauhan d621166c80 s/hidden/onion/g in code comments 2021-12-13 13:18:53 -08:00
Daniel Eades 2bcd7b6d78 address lint warnings
[Edited by nickm: This applies one of Daniel's fixes in place of one
 of Trinity's: Trinity says it's a bit cleaner, and I agree.]
2021-12-09 08:06:32 -05:00
Trinity Pointard 9753a7ee06 fix nightly clippy errors 2021-12-09 12:16:23 +01:00
Nick Mathewson 4536c2ac87 Upgrade to digest v0.10.0
We generally try to track the latest rust-crypto traits when we can:
fortunately, this upgrade didn't break much, considering.
2021-12-07 20:33:46 -05:00
Nick Mathewson 31b385c5b2 Resolve roughly half of the XXXXs.
We want to only use TODO in the codebase for non-blockers, and open
tickets for anything that is a bigger blocker than a TODO.  These
XXXXs seem like definite non-blockers to me.

Part of arti#231.
2021-12-06 15:11:03 -05:00
Neel Chauhan f5362028b4 Remove dir_port from RouterStatusBuilder 2021-12-01 21:51:49 -08:00
Nick Mathewson e2a7289aa7 Add comments about the absence of tap_key in microdesc. 2021-11-30 14:05:13 -05:00
Nick Mathewson 9afe5c09e7 Merge remote-tracking branch 'origin/mr/151' 2021-11-30 14:03:46 -05:00
Nick Mathewson 3b072c5420 Merge branch 'readme_fixes' 2021-11-30 09:12:51 -05:00
Nick Mathewson eef81d9d57 Bump every crate by one patch version. 2021-11-29 15:21:58 -05:00
Nick Mathewson 805e558045 Run "cargo update" to get latest versions.
Also fix a couple of warnings introduced by now-unneeded imports
with new ed25519 crate.

This is part of the process for releasing our next version.
2021-11-29 14:52:53 -05:00
Neel Chauhan d47549b1ab Parse RSA public key 2021-11-29 11:00:53 -08:00
Nick Mathewson df3a790665 Merge remote-tracking branch 'origin/mr/149' 2021-11-29 09:17:01 -05:00
dagon d5c48c616f run ./maint/readmes.sh 2021-11-29 21:29:28 +10:00
Neel Chauhan 50bf2e7c86 Remove address from VoterInfoBuilder 2021-11-28 20:44:27 -08:00
Neel Chauhan 2cde3608da Remove unused tap_onion_key and tap_key 2021-11-28 20:36:02 -08:00
Neel Chauhan 1d4b448ec2 Remove unused 'address' field from DirSource struct 2021-11-28 19:54:15 -08:00
Daniel Eades db16d13df4 add semicolons if nothing returned 2021-11-25 13:20:37 +00:00
Daniel Eades 052f51ff71 deglob some enums, use concise iteration syntax 2021-11-25 12:39:52 +00:00
Nick Mathewson 3e7e599a22 More typo fixes that I forgot to save :( 2021-11-24 18:23:12 -05:00
eta e35a8bf60e Merge branch 'arti-client-config' into 'main'
Further configuration refactoring

See merge request tpo/core/arti!137
2021-11-22 15:43:22 +00:00
Nick Mathewson 354a0f97f2 Use consistent name for ns_consensus feature. 2021-11-21 21:11:14 -05:00
Nick Mathewson 40ff7113d4 Make every Config type implement Eq.
Doing this is necessary for reconfiguration support, and will help a lot
with testing, too.
2021-11-21 12:06:15 -05:00
eta a85e83c807 Merge branch 'ticket125' into 'main'
Put most non-universally-needed functionality behind features

Closes #125

See merge request tpo/core/arti!129
2021-11-16 18:31:00 +00:00
Nick Mathewson 69bb6313fd Remove the unused `published` field from GenericRouterStatus.
This field isn't used in modern Tor, and has never been used in
Arti.  If tor!489 is merged, then it will no longer contain a useful
value in future consensuses.  We shouldn't store it, or else
somebody else will get the smart idea of using it for something.

This commit breaks API compatibility for tor-netdoc with the
`build_docs` feature enabled.  I haven't entered that into the
semver_status.md file, since we already have a pending tor-netdoc
API breaker in !129.
2021-11-12 13:54:03 -05:00
Nick Mathewson 773c0dc332 tor-netdoc: put NS consensus documents behind a feature.
Clients never need these.

Part of #125.
2021-11-12 12:15:34 -05:00
Nick Mathewson 84fbff54a5 tor-netdoc: Split the two kinds of routerstatus into their own modules 2021-11-12 12:15:34 -05:00
Nick Mathewson 7b12b54d40 tor-netdoc: Put the "routerdesc" document type behind a feature.
Nothing in arti currently uses this document type.  Eventually it
will be useful for relays and for bridge clients.

I've left the "SHA1 digest of a router descriptor" type available
unconditinoally, however, since it does get used in a few places.

Part of #125.
2021-11-12 12:15:30 -05:00
Nick Mathewson ee030260fb Add a couple of pieces of missing documentation. 2021-11-08 16:06:08 -05:00
Nick Mathewson cdae4c033c Remove some dbg!() calls in real code. 2021-11-02 09:50:55 -04:00
Nick Mathewson e6e740646a Bump all crate versions to 0.0.1 2021-10-29 11:05:51 -04:00
Nick Mathewson e64177d97e Fix some clippy-nightly warnings.
These are my fault; I merged the wrong version of !102. :p
2021-10-26 13:13:46 -04:00
Nick Mathewson 4893e9a15f Migrate tor-netdoc from chrono to time 0.3
(This appears to be the emerging consensus of how to handle
RUSTSEC-2020-0159.)
2021-10-24 10:50:21 -04:00