aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
| * tor-netdoc: Introduce RelayWeights and use it in RouterStatus (pre)Ian Jackson2026-05-271-1/+2
| | | | | | | | Minor change which will make the next diff clearer.
| * tor-netdoc: use TryFrom impl in RelayWeight parserIan Jackson2026-05-271-5/+5
| | | | | | | | | | This makes the error handling a bit more regular. It will also make the code suit our further parsing changes better.
| * tor-netdoc: impl TryFrom<&NetParams<u32>> for RelayWeightIan Jackson2026-05-272-1/+21
| | | | | | | | | | Convert the from_net_params constructor into a TryFrom. Retain the bespoke method for the benefit of the old parser.
| * tor-netdoc: Unknown: provide into_retained even when retained disabledIan Jackson2026-05-272-1/+2
| |
| * tor-netdoc: impl encoding and parsing for NetParams<T>Ian Jackson2026-05-272-3/+8
| | | | | | | | | | Not just NetParams<i32>. We're going to want it for NetParams<u32> in a moment.
| * tor-netdoc: NetdocParseableFields: Pass ItemStream to finishIan Jackson2026-05-275-8/+24
| |
| * tor-netdoc: implement encoding for rs::SoftwareVersionIan Jackson2026-05-272-0/+8
| | | | | | | | Call the existing string encoding code.
| * tor-netdoc: implement encoding for IgnoredPublicationTimeSpIan Jackson2026-05-272-0/+8
| | | | | | | | | | This seems trivial enough I don't feel the need to mark it "incomplete" even though there is no test case.
* | tor-netdoc: Spec link for RouterDesc::or_addressClara Engler2026-05-271-2/+1
| |
* | tor-netdoc: Store or-address in a SocketAddrClara Engler2026-05-272-8/+8
|/ | | | | | | | | | | | | | | | | | | | | | This commit changes the data type of RouterDesc::or_address from Option<(net::IPv6Addr, u16)> to Vec<net::SocketAddr>. This is the correct behavior according to the spec, meaning I will not give a lengthy explanation on why this is better. Reviewers might now be questioning whether the spec is wrong and/or if this is a dangerous change, as Arti used to only extract the first IPv6 address and CTor doing a similar thing. Following an IRC discussion with nickm@, we came to the conclusion that both implementation techniques are right. It is okay for the document to hold multiple addresses, it is okay for the implementation to ignore all but the first (IPv6 address). What is not okay however, is for an implementation to reject documents with multiple addresses. Besides, router descriptors are not used in the existing code for selecting the address of a relay, meaning this change has very little practical meaning.
* tor-netdoc: Restore one-line formatting of use lineIan Jackson2026-05-271-5/+1
| | | | I unwrapped this for conflict resolution.
* tor-netdoc: Properly replace parse2::lex::NoFurtherArgumentsIan Jackson2026-05-273-18/+6
| | | | | | | | | | | | | | | As pointed out in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413185 this was a duplicate. The new NoFurtherArguments * Implements encoding * Implements more traits * Is in the right module (types::misc - it's not just for parsing) * Has a slightly better name * Had an open-coded parsing impl (which we now replace) * Had minor differences to docs (so we add a line to NoFurtherArguments)
* tor-netdoc: Remove duplicate semver entryIan Jackson2026-05-271-1/+0
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413184
* tor-netdoc: Add some TODOsIan Jackson2026-05-271-0/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413183
* tor-netdoc: Rename FixedString to ConstantStringIan Jackson2026-05-275-34/+34
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413182 I left the word "fixed" in some of the docs and error messages, where it seemed to make sense.
* tor-netdoc: Apply deferred rustfmt import churnIan Jackson2026-05-272-3/+5
|
* tor-netdoc: introduce VoteStatusConsensus and VoteStatusVoteIan Jackson2026-05-273-36/+16
| | | | | Replacing poc's. The new define_fixed_string macro is really helping here.
* tor-netdoc: NetworkStatusVersionItem, replacing poc's tupleIan Jackson2026-05-273-7/+34
| | | | | Defining a struct gives us a place to hang the documentation, and avoids an accidentally-exhaustive tuple.
* tor-netdoc: VarietyKeyword, replacing poc's flavour typeIan Jackson2026-05-274-27/+76
| | | | | | | This is more code than the poc version but much of the extra is documentation, and it seems much less magical this way. We still need a handwritten parser for plain consensuses, sadly.
* tor-netdoc: Promote/adjust poc's NetworkStatusSignaturesIan Jackson2026-05-272-10/+17
| | | | | | | | The order of arguments of poc's ns_type macro is different to that of the real code. This is very confusing! However, the type is correct, once we've added the singleton signature for votes.
* tor-netdoc: Provide NoMoreArguments markerIan Jackson2026-05-273-2/+32
| | | | | | We're going to need this for type-driven parsing of the necessarily-absent flavour argument in a vote's `network-status-version`.
* tor-netdoc: use DirectorySignaturesHashesAccu in SignatureGroupIan Jackson2026-05-273-7/+16
| | | | | | This will let us (re)use the existing signature checking code with the parse2 type, since we'll be able to make a SignatureGroup out of a parse2'd UnverifiedNetworkStatus.
* tor-netdoc: Make fields of DirectorySignaturesHashesAccu publicIan Jackson2026-05-272-2/+5
| | | | | This will allow it to be a replacement inside `SignatureHashes`. Keeping the fields private seems to have been an oversight.
* tor-netdoc: SignatureGroup: add some notes to the docsIan Jackson2026-05-271-0/+4
|
* tor-netdoc: Replace poc's NddDirectoryFooter with new FooterIan Jackson2026-05-274-10/+30
| | | | | This is the whole of the footer section, with docs, appropriate derives, and so on.
* tor-netdoc: ConsensusFooterFields: Constructor, parse, encodeIan Jackson2026-05-273-3/+14
|
* tor-netdoc: ConsensusFooterFields: Tidy docsIan Jackson2026-05-271-4/+4
| | | | | Add links to the spec, and delete explanatory text (that ought to be in the spec, not here).
* tor-netdoc: ConsensusFooterFields: Rename weights field to bandwidth_weightsIan Jackson2026-05-274-6/+7
| | | | This matches the spec.
* tor-netdoc: Rename Footer to ConsensusFooterFieldsIan Jackson2026-05-275-11/+14
| | | | | | | | | | | This will allow us to include this, conditionally, in the new per-variety footer types for consensuses, without too much disruption to the existing code. We don't leave a compatibility alias because we're going to want a Footer in each_variety.rs which is the actual sub-document. This old struct isn't suitable because it doesn't have the intro item and is just for consensuses.
* tor-netdoc: NetworkStatusVersion, replacing poc's with FixedStringIan Jackson2026-05-273-11/+15
|
* tor-netdoc: Provide FixedString and defined_fixed_stringIan Jackson2026-05-273-1/+146
| | | | We're going to want quite a lot of this for eg network-status-version.
* Merge branch 'rd-bandwidth' into 'main'Ian Jackson2026-05-273-0/+29
|\ | | | | | | | | Add Bandwidth support to Router Descriptors See merge request tpo/core/arti!4005
| * tor-netdoc: Add bandwidth field to RouterDescClara Engler2026-05-262-0/+9
| | | | | | | | | | | | This commit adds the bandwidth field to the RouterDesc struct as it is found within the spec. The legacy parser will not support it, hence why we do default values there.
| * tor-netdoc: Add Bandwidth structClara Engler2026-05-262-0/+20
| | | | | | | | | | This commit adds the bandwidth struct for router descriptors which is present in the `bandwidth` item.
* | Merge branch 'doc-digest-reorg' into 'main'Clara Engler2026-05-2711-66/+177
|\ \ | |/ |/| | | | | tor-netdoc: Implement encoding for referenced doc digest in rs entries See merge request tpo/core/arti!3989
| * tor-netdoc: Implement encoding for md rs digestIan Jackson2026-05-182-1/+14
| | | | | | | | | | This is not tested yet. It will be tested when we add round-trip tests for votes.
| * tor-netdoc: Fix comment about from_unparsedIan Jackson2026-05-181-1/+1
| | | | | | | | This doesn't parse the keyword, only the value.
| * tor-netdoc: Tidy doc_digest_parse2_m into doc_digest_item_mIan Jackson2026-05-182-5/+5
| | | | | | | | | | | | | | | | | | * Rename it so that it doesn't mention parse2, because we're going to want to encode too. * Remove the indirection: rename the one in md.rs to be the name that's used in `with = `. (Previously, things were more complicated so the extra layer of indirection was helpful.)
| * tor-netdoc: rs referenced doc digests: Use FixedB64 (fmt)Ian Jackson2026-05-181-2/+1
| |
| * tor-netdoc: rs referenced doc digests: Use FixedB64Ian Jackson2026-05-186-42/+22
| | | | | | | | | | | | | | FixedB64 is the right type for these, when they are present. This abolishes some ad-hoc boilerplate. Sadly we still need a bit of that for Reasons.
| * tor-netdoc: relay flags with: Use ns_type! rather than conditional importIan Jackson2026-05-181-4/+7
| | | | | | | | | | | | | | | | Previously, this was't possible because derive-deftly wanted a string. But now it can take a type, and types can contain macro calls inside their generics etc. This makes the code much more local and direct.
| * tor-netdoc: Fix comments in rs variety filesIan Jackson2026-05-183-3/+3
| | | | | | | | This is router *status* not router *descriptor*.
| * tor-netdoc: Fix NotPresent to use same Each valueIan Jackson2026-05-183-13/+93
| |
| * tor-netdoc: Document that parse2 vs encode multiplicity match req'tIan Jackson2026-05-183-4/+40
| |
* | Merge branch 'routerdescs-certs' into 'main'Clara Engler2026-05-193-4/+508
|\ \ | | | | | | | | | | | | Implement Elliptic Curve Certificates for Router Descriptors See merge request tpo/core/arti!3939
| * | tor-netdoc: Remove round-trip Ed25519 cert verificationClara Engler2026-05-191-20/+0
| | | | | | | | | | | | | | | | | | This commit removes the Ed25519 round-trip verifciation in certificate creation because it reduces the code complexity and is pretty uncommon in cryptographic code.
| * | tor-netdoc: Add TODO for family name getterClara Engler2026-05-191-0/+3
| | |
| * | tor-netdoc: Test invalid certified key typeClara Engler2026-05-191-0/+9
| | | | | | | | | | | | | | | This commit tests an invalid certified key type by adding a test that does not use CertifiedKey::Ed25519.
| * | tor-netdoc: Prepare tests for invalid certified key type (fmt)Clara Engler2026-05-191-1/+7
| | | | | | | | | | | | No functional change.
| * | tor-netdoc: Prepare tests for invalid certified key typeClara Engler2026-05-191-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adjusts the tests to make it possible to add a test for a non-matching certified key type. For this, we simply store the certified key as a CertifiedKey and not as an Ed25519Identity. Inevitably, this requires us to "force" create such an identity on the fly in order to test the mismatch, which is fine because it is an edge-case anyways.