aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'testdata-export-bis' into 'main'Ian Jackson2026-07-2732-484/+728
|\ \ | | | | | | | | | | | | tor-netdoc testdata-live: More shell script, less macrology See merge request tpo/core/arti!4238
| * | tor-netdoc testdata-live: Abolish selected_relays.rsIan Jackson2026-07-272-27/+0
| | | | | | | | | | | | | | | This is no longer used. Get rid of the code which generates it, and the generated file.
| * | tor-netdoc testdata-live: Switch to generated_consts.rsIan Jackson2026-07-271-61/+7
| | | | | | | | | | | | | | | This gits rid of the macrology, apart from the generated macro module file.
| * | tor-netdoc testdata-live-download: Generate generated_consts.rsIan Jackson2026-07-272-1/+324
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the code for the new approach. It's kind of ad-hoc but also much less deep than the previous macrology. And, run the script to see the output. Currently that file isn't used. For now we leave the shell script code for generating selected_relays.rs in testdata-live-download. The new code for generated_consts.rs is very different, so it's clearer to split the changes up this way.
| * | tor-netdoc testdata-live: Run a downloadIan Jackson2026-07-2728-396/+398
| | | | | | | | | | | | | | | | | | | | | | | | | | | I'm going to change the generation, and that means I need input files, so I need to run a download (as per the comment in testdata-live-download). I'm doing this first, so the rest of the MR can see individual changes.
* | | Merge branch 'testdata-report-nits' into 'main'Ian Jackson2026-07-271-1/+5
|\| | | |/ |/| | | | | tor-netdoc testdata-live: Two nits See merge request tpo/core/arti!4237
| * tor-netdoc testdata-live: Add a comment about running without downloadIan Jackson2026-07-271-0/+4
| |
| * tor-netdoc testdata-live: Fail if curl failsIan Jackson2026-07-271-1/+1
| |
* | Merge branch 'netdoc-affordances' into 'main'Ian Jackson2026-07-276-20/+38
|\ \ | | | | | | | | | | | | tor-netdoc: Add a few affordances See merge request tpo/core/arti!4235
| * | tor-netdoc: docs: fix typos and linkifyIan Jackson2026-07-271-2/+2
| | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439437 https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439438
| * | tor-netdoc: Don't writhe in a doc commentIan Jackson2026-07-271-1/+1
| | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4235#note_3439436
| * | tor-netdoc: derive Hash for netstatus::ConsensusMethodsIan Jackson2026-07-232-1/+2
| | |
| * | tor-netdoc: Use encode_netdoc_unsigned in several placesIan Jackson2026-07-233-19/+9
| | |
| * | tor-netdoc: Provide free functions for encodingIan Jackson2026-07-232-0/+27
| | | | | | | | | | | | | | | I keep finding I want to encode things and then I have to prat about with a NetdocEncoder. Let's provide potted versions.
* | | Merge branch 'testdata-export' into 'main'Ian Jackson2026-07-2732-357/+474
|\ \ \ | |/ / |/| / | |/ | | tor-netdoc testdata-live: Export for the benefit of other crates See merge request tpo/core/arti!4229
| * tor-netdoc testdata-live: Export for the benefit of other cratesIan Jackson2026-07-232-0/+89
| | | | | | | | | | | | | | | | Add a new testdata_live module which is exposed with the testing features, containing the testdata-live in string constants. This avoids the need for test cases in other crates to walk the filesystem to an area outside their own crate path.
| * Require derive-deftly 1.11.4Ian Jackson2026-07-231-1/+1
| | | | | | | | | | | | | | | | | | We're about to *use* the fix that was in 1.11.4. We already updated the lockfile in !4228, so this is just Cargo.toml changes (which will prevent the minimal-versions tests failing when we change the code to rely on the fix). git-grep -l '^derive-deftly' |xargs perl -i~ -pe 's{\b\Q1.11.3\E\b}{1.11.4}g'
| * tor-netdoc testdata-live: Run a downloadIan Jackson2026-07-2328-356/+367
| | | | | | | | | | | | | | This updates everything, but really I'm just running it to create the new selected_relays.rs file. The meaning of this file will become clear shortly.
| * tor-netdoc testdata-live: Write out a selected_relays.rs fileIan Jackson2026-07-231-0/+17
| | | | | | | | | | | | | | We could use build.rs for this, but since we have a script already, this seems better. The meaning of this file will become clear shortly.
* | tor-netdoc: HsDesc parse_decrypt_validate: Fix docs re time boundsIan Jackson2026-07-231-1/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4223#note_3438348
* | HsDesc::parse_decrypt_validate: Don't check validity time (style followup)Ian Jackson2026-07-231-5/+3
| |
* | HsDesc::parse_decrypt_validate: Don't check validity timeIan Jackson2026-07-232-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function returns a `TimeRangeBound`. That implies a responsibility on the caller to check the time. It doesn't make sense for this function to do the check as well. But, it turns out that in tor-hsclient, the `TimeRangeBound<HsDesc>` is sometimes processed with `.dangerously` on the assumption that it was checked earlier. I considered changing this, and storing plain `HsDesc` and a separate `TimeRange` - but that's not right, because there are places where the `TimeRangeBound<HsDesc>` is used well after it was verified. Instead, in this commit, I (effectively) move the `.check_valid_at` call from `parse_decrypt_validate` to its principal call site. This involves a change to the error representation. Previously, validity time errors ended up as `DescriptorErrorDetail::Descriptor` containing an `HsDescError::OuterValidation` HsDescError:: InnerValidation`, which in turn contains a `tor_netdoc::Error`. (`tor_netdoc::Error` is a rather awkward type.) Now we have our own error variant. The overall behaviour is unchanged.
* | tor-netdoc: hsdesc: Use new TimeRangeBound::build_intersect (fmt)Ian Jackson2026-07-231-5/+4
| |
* | tor-netdoc: hsdesc: Use new TimeRangeBound::build_intersectIan Jackson2026-07-231-27/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace open-coding of various is_valid_at and various dangerously and intersect. In more detail: * Do most of the processing inside `TimeRangeBound::build_intersect` * Replace uses of dangerously_peek etc. with `TimeBound::unwrap_with` * The timebound machinery now takes care of doing the intersection * Remove the individual `.is_valid_at` calls and replace them with one at the end, on the intersection. This preserves the current behaviour except that sometimes time validity errors will now be reported as having occurred the wrong level. We'll deal with this in a moment (by deleting these checks from here entirely). * There is no need to handle a `None` from `intersect` any more. TimeBound handles conflicting time ranges differently: it allows ranges which are empty due to being ill-formed.
* | tor-netdoc: hsdesc: Rename a variableIan Jackson2026-07-231-2/+2
| | | | | | | | | | This variable had a different name inside the block, to outside. This was confusing, and, fixing it makes the next commit clearer.
* | tor-checkable: Rename `TimeBound::is_valid_at` to `check_valid_at` (fmt)Ian Jackson2026-07-231-1/+5
| |
* | tor-checkable: Rename `TimeBound::is_valid_at` to `check_valid_at`Ian Jackson2026-07-233-6/+6
| | | | | | | | | | I find this names confusing. To my mind "is" implies a function returning `bool`.
* | tor-checkable: Rename `TimeBound::check_valid_*` to `if_valid_*`Ian Jackson2026-07-237-25/+25
| | | | | | | | | | | | | | I find these names confusing. To my mind "check" implies a function returning `Result<(), _>`. Some other APIs use `unwrap` here but I think `if` is good.
* | tor-checkable: TimeBound: Make dangerously_into_parts return TimeRangeIan Jackson2026-07-231-1/+2
| | | | | | | | | | It is better to return a more cooked type. `TimeRange` aka `TimeRangeBound<()>` is perfect for this.
* | tor-checkable: TimeRangeBound: Rename extend_tolerance to extend_end_boundIan Jackson2026-07-232-3/+3
| | | | | | | | | | | | | | | | | | It was confusing that one of these functions had "which bound" mentioned in its name, but the other didn't. So add `end` and switch from `tolerance` to `bound` (see previous commit message). *This* commit should deal only in `extend_tolerance` and `end` and shouldn't touch `extend_start_bound` or `extend_pre_tolerance`.
* | tor-checkable: TimeRangeBound: Rename extend_pre_tolerance to extend_start_boundIan Jackson2026-07-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Although it is often used to apply a tolerance, it doesn't make sense to say that this is extending the "tolerance" of a `TimeRangeBound`. A `TimeRangeBound` doesn't have a tolerance, only bounds. Also we should be consistent in our terminology, and use `start` rather than `pre`. We'll rename the other method too. Doing them one at a time will makes it easier to spot any "pre/start" vs "<nothing>/end" slips: *this* commit should deal only in `pre` and `start` and shouldn't touch `extend_tolerance`.
* | tor-checkable: TimeRangeBound: Rename bounds to bounds_start_endIan Jackson2026-07-231-1/+1
|/ | | | | | | | | | This just returns a tuple. We're going to introduce a new method that returns a `TimeRagne` and will want to be called `bounds`. That method will want to be in the `TimeBound` trait, but for now we add it here. Various call sites will be added in forthcoming commits.
* tor-netdoc testdata-live: Clarify what should be committedIan Jackson2026-07-221-2/+4
|
* tor-netdoc: Fix grammar in a commentIan Jackson2026-07-221-1/+1
|
* tor-netdoc testdata-live: Save selected routers' descriptors (effect)Ian Jackson2026-07-2215-0/+819
| | | | | | | Run crates/tor-netdoc/testdata-live-download with the locally saved, previously downloaded, network statuses. It downloaded these descriptors.
* tor-netdoc testdata-live: Save selected routers' descriptorsIan Jackson2026-07-222-0/+30
|
* tor-netdoc testdata-live: Split off selected routers' routerstatus entries ↵Ian Jackson2026-07-2215-0/+120
| | | | | | | | | | (effect) Run crates/tor-netdoc/testdata-live-download with the locally saved, previously downloaded, network statuses. (It didn't download anything extra, but it did produced these new output files, as expected.)
* tor-netdoc testdata-live: Split off selected routers' routerstatus entriesIan Jackson2026-07-221-1/+5
| | | | | This will be convenient for saving their descriptors, and may be useful for other purposes too.
* tor-netdoc testdata-live: Download fresh dataIan Jackson2026-07-223-70/+380
| | | | Precisely a run of crates/tor-netdoc/testdata-live-download.
* tor-netdoc testdata-live: Document the contents of testdata-live/Ian Jackson2026-07-221-0/+7
|
* tor-netdoc testdata-live: Report URLs we are downloading to stderrIan Jackson2026-07-221-0/+1
|
* tor-netdoc testdata-live: Do not re-download already-fetched inputsIan Jackson2026-07-224-398/+93
| | | | We don't fetch files to the names we commit.
* tor-netdoc testdata-live: Add http:// to URLsIan Jackson2026-07-211-1/+1
| | | | curl infers this, but we should include it.
* tor-netdoc testdata-live: Break out run-curl functionIan Jackson2026-07-211-1/+7
|
* tor-netdoc tests; work around version number ordering issueIan Jackson2026-07-211-0/+16
| | | | | | | | | Ideally we would have Arti sort things sensibly but currently we have no types in Arti that are (1) faithful (2) sort correctly. Most of the existing types eventually have a `TorVersion` inside, which is lossy, so we can't use them for (eg) dirauth network status processing.
* tor-netdoc: Provide PortPolicy::from_ordered_allowed_rangesIan Jackson2026-07-212-1/+23
| | | | | | In some sense this is a convenience wrapper around `push_ordered`, but, really, it's the only nontrivial constructor that doesn't take an iterator of individual port numbers.
* tor-netdoc: Rename PortPolicy::from_allowed_ranges to from_allowed_port_rangesIan Jackson2026-07-212-3/+2
| | | | | This takes a PortRanges. We're going to introduce another function to construct from an iterator.
* tor-netdoc: Break out and expose parse_testcase_from_netdocIan Jackson2026-07-213-29/+78
|
* tor-netdoc: NetdocParseableFields::Accumulator must be DefaultIan Jackson2026-07-212-1/+2
| | | | | | The macro-generated code for `#[deftly(netdoc(flatten))]` relies on this. The Default impl is genereated by the derive, but a generic or handwritten `NetdocParseableFields` wouldn't work.
* tor-netdoc: Add a couple of calls to .void_unwrap()Ian Jackson2026-07-211-3/+5
| | | | | Otherwise our MSRV compiler prints a warning, that this was an unhandled Result.