Nick Mathewson
74ef8de86f
Merge branch 'doc-iter' into 'main'
...
Introduce new batching iterator and use it in two places
See merge request tpo/core/arti!1016
2023-02-13 18:59:42 +00:00
Ian Jackson
297019bb23
batching_split_before: Whitespace error fix
2023-02-13 17:34:04 +00:00
Ian Jackson
b4d0b585c2
batching_split_before: Better xref for doc hidden
...
And another UNSTABLE warning.
2023-02-13 17:32:54 +00:00
Ian Jackson
1232bb6661
batching_split_before: Clarify API sequential restriction
2023-02-13 17:29:17 +00:00
Ian Jackson
5be6db006c
batching_split_before: Fix and clarify Batches/LendingIterator doc
2023-02-13 17:28:39 +00:00
Ian Jackson
15f33ce13c
batching_split_before: Introduce unit token types
...
And explain why we're not using booleans.
2023-02-13 17:19:13 +00:00
Ian Jackson
73a20cdc36
batching_split_before: Expand on the remaining use of "meta-iterator"
2023-02-13 17:13:55 +00:00
Ian Jackson
04e3a22b82
batching_split_before: Fix link to BatchesWithHeader::subsequent
2023-02-13 17:12:17 +00:00
Ian Jackson
53ef0d65ea
batching_split_before: Provide description for BatchesWithHeader
2023-02-13 17:09:08 +00:00
Ian Jackson
6799fb6e3e
batching_split_before: Document generics on our non-private types
2023-02-13 17:04:29 +00:00
Ian Jackson
e44be77f52
batching_split_before: Rename "prefix" to "header"
...
As per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1016#note_2877759
"_prefixed" becomes "_with_header". That mirrors the returned struct
which is nice.
2023-02-13 16:55:36 +00:00
Ian Jackson
72b1cb797d
batching_split_before: Rename "start" to "batch-starting"
...
Roughly as per
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1016#note_2877822
2023-02-13 16:52:07 +00:00
Ian Jackson
09060b4748
batching_split_before: Remove false assertions about batch contents
2023-02-13 16:44:47 +00:00
Ian Jackson
4333a1ef1c
batching_split_before: Clarify heading of BatchesWithPrefix
2023-02-13 16:37:13 +00:00
Nick Mathewson
5c1cbd5486
batching_split_before: docs improvements.
2023-02-13 16:12:26 +00:00
Nick Mathewson
7363bee6a4
netdoc: give hsdesc test info in its original form.
2023-02-13 10:30:27 -05:00
Ian Jackson
8703a969f4
tor-netdoc: Use batching iterator in authcert.rs
...
This gets rid of a lot of manual boolean state variable iterator
stuff.
2023-02-10 19:48:26 +00:00
Ian Jackson
d35f7990e8
tor-netdoc: Use batching_split_before in HsDescInner
2023-02-10 19:47:45 +00:00
Ian Jackson
fd35f05b26
tor-netdoc: Provide new batching_split_before
...
There will be two call sites to demonstrate it.
Eventually maybe this will want to be in tor-basic-utils, since it
doesn't depend on any of the tor-netdoc types. But it would be
sensible to wait until the situation with PeekableIterator and
Itertools is improved.
For now we make this #[doc(hidden)] to avoid it becoming part of our
stable API.
2023-02-10 19:47:45 +00:00
Ian Jackson
1b5a5eb57a
tor-netdoc: Provide NetDocReader::into_iter
...
This will avoids some hairy borrowck disasters when we try to use
iterator adapters.
2023-02-10 19:47:45 +00:00
Ian Jackson
5f0ff78c2d
tor-netdoc: util: use super::* in tests
...
Not xure how my MR to try to do this everyone missed this one.
2023-02-10 19:47:45 +00:00
Ian Jackson
a5be14ed5e
tor-netdoc: util: Add standard lint block to tests
...
Not xure how my MR to try to do this everyone missed this one.
2023-02-10 12:47:02 +00:00
Nick Mathewson
3f5502c5bc
netdoc: Add a test for HSDesc decryption.
2023-02-10 07:36:40 -05:00
Nick Mathewson
ced33029f6
Add another test hsdesc to parse.
...
This one was generated (by dgoulet) using `ClientDescEncKey`
encryption. Its information is:
```
Address: paozpdhgz2okvc6kgbxvh2bnfsmt4xergrtcl4obkhopyvwxkpjzvoad.onion
Time period: 19397
Client:
paozpdhgz2okvc6kgbxvh2bnfsmt4xergrtcl4obkhopyvwxkpjzvoad:descriptor:x25519:SDZNMD4RP4SCH4EYTTUZPFRZINNFWAOPPKZ6BINZAC7LREV24RBQ
Service:
descriptor:x25519:SACGOAEODFGCYY22NYZV45ZESFPFLDGLMBWFACKEO34XGHASSAMQ
```
2023-02-10 07:26:31 -05:00
Ian Jackson
62fa652fcd
Merge branch 'hsdir' into 'main'
...
Compute the HS directory hash ring
See merge request tpo/core/arti!1012
2023-02-09 16:35:42 +00:00
Nick Mathewson
73ce68ac21
Rename DescEncNonce => HsDescEncNonce
2023-02-09 08:57:09 -05:00
Ian Jackson
f5c3c1f277
hsdir: Be able to enumerate the hidden service directories
...
* Provide an accessor for the HSDIR flag
* Provide a function for testing a relay for hsdir inclusion
* Provide an iterator on NetDir that returns the hsdirs
2023-02-09 13:01:37 +00:00
Ian Jackson
81d4e6971b
tor-netdoc: Discuss that relays are ordered by rsa id in Consensus
2023-02-09 12:56:18 +00:00
Nick Mathewson
0a80c468df
hsdesc: Use an IntegerMinutes<u16> to hold lifetime.
2023-02-08 13:33:07 -05:00
Nick Mathewson
39f5f90f3f
netdoc: Fix most "TODO HS rename" comments
2023-02-08 13:23:21 -05:00
Nick Mathewson
8c3bd3626b
netdoc::hsdesc: Distinguish layer from document.
2023-02-08 13:16:44 -05:00
Nick Mathewson
966ddeb092
netdoc::hsdesc: Rename "layer" modules.
2023-02-08 13:08:57 -05:00
Nick Mathewson
964ca511c4
netdoc::hsdesc: Excise reference to "password" authentication
...
As far as we can tell, this never existed.
2023-02-08 12:57:52 -05:00
Nick Mathewson
cce56c793b
hscrypto,netdoc: Add and use a type for KP_hss_desc_enc.
2023-02-08 12:50:34 -05:00
Nick Mathewson
99ec1c9818
tor-hscrypto: Rename key types to correspond to new spec names.
2023-02-08 12:27:36 -05:00
Nick Mathewson
d1ee5807ed
Rename DescriptorCookie to DescEncNonce
...
(I think it's okay to omit the Hs here, since this type is not
visible outside the hsdesc parsing code. I'll rename if others
disagree.)
2023-02-08 12:10:24 -05:00
Nick Mathewson
39e1116ece
Renaming cleanup for and around now-renamed "KP_hs_desc_ephem".
2023-02-08 12:06:42 -05:00
Nick Mathewson
18e8ac7cb6
Rename key identifiers that have changed in the spec
...
Generated with perl:
s/K([PS])_hs_intro_tid/K$1_hs_ipt_sid/g;
s/K([PS])_onion_ntor/K$1_ntor/g;
s/K([PS])_hs_intro_ntor/K$1_hss_ntor/g;
s/K([PS])_hs_desc_ephem/K$1_hss_desc_enc/g;
2023-02-08 11:57:51 -05:00
Dimitris Apostolou
d1eeffbf42
Fix typo
2023-02-08 00:04:25 +02:00
Nick Mathewson
f537a7ad48
Update hsdesc parser code to new sectionrules::builder code.
2023-02-07 15:28:10 -05:00
eta
c7c4fff66e
Merge branch 'authcert_bug' into 'main'
...
Fix AuthCert behavior on unrecognized tokens, and prevent bug from recurring elsewhere.
Closes #752
See merge request tpo/core/arti!1006
2023-02-07 16:06:20 +00:00
Nick Mathewson
a1c36b2087
netdoc: Add a comment about renaming layer to document.
2023-02-07 09:02:15 -05:00
Nick Mathewson
257aaf9e5b
netdoc::hsdesc: rename Passwd to Password.
2023-02-07 09:02:15 -05:00
Nick Mathewson
2ba28aa289
netdoc: Rename/comment objects from hsdesc.
2023-02-07 09:02:15 -05:00
Nick Mathewson
d10ccf0dc5
netdoc: Rename/comment objects from inner_layer.
2023-02-07 09:02:15 -05:00
Nick Mathewson
1cdd36f511
netdoc: Rename/comment objects from middle_layer.
2023-02-07 09:02:15 -05:00
Nick Mathewson
1a59005ae0
netdoc: Rename/comment objects from desc_enc
2023-02-07 09:02:15 -05:00
Nick Mathewson
7701e02aad
netdoc: Renaming and comments in outer_layer.
2023-02-07 09:02:15 -05:00
Nick Mathewson
68d2ccf5fe
netdoc: Use Itertools::exactly_once in hsdesc parsing
2023-02-07 09:02:15 -05:00
Nick Mathewson
3d53a30c94
netdoc: Remove useless should_be_exhausted calls.
2023-02-07 09:02:15 -05:00
Nick Mathewson
cff2326f6f
Remove a needless line.
2023-02-07 09:02:15 -05:00
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