summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: Promote DirectorySignatureHashAlgo from poc as nasty macroIan Jackson2026-04-291-12/+2
| | | | | | | | | | | | | | We want DirectorySignatureHashAlgo for prod's directory Signature type. However, for complex cfg gate and macro scoping reasons, we can't just move the definition out of poc. Hence this rather unpleasant intermediate state. This will go away, and become normal again, when we can abolish poc's signatures and have poc use a prod signature type. Review with git show --color=always --color-moved-ws=allow-indentation-change --color-moved
* tor-netdoc: poc: make DirectorySignatureHashAlgo serialise properlyIan Jackson2026-04-291-0/+1
|
* tor-netdoc: Move FromStr and Display from NormalItemArgument to implsIan Jackson2026-04-291-1/+1
| | | | | | | | | | | This allows implementing NormalItemArgument for types that can only be parsed, or only displayed - or other combinations. I noticed this restriction while inventing a type I later decided was unnecessary. I still think it's a good change. There is no practical impact elsewhere, since in practice downstream code implements NormalItemArgument rather than relying on it.
* Merge branch 'ns-auth-entry' into 'main'Clara Engler2026-04-273-141/+5
|\ | | | | | | | | tor-netdoc: Parsing and encoding for netstatus authority sections See merge request tpo/core/arti!3892
| * tor-netdoc: consensus authority section: ConsensusAuthoritySectionIan Jackson2026-04-272-86/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace poc code with new ConsensusAuthoritySection. This is an entirely new parsing approach. Key differences: * We parse the arguments to dir-source, which poc didn't. * We don't clone the input and fully parse the first item; instead, we dismantle the dir-source line ad-hoc to determine the item type. * Rather than a Vec of Enums, we parse into two Vecs of the different entry types. The few lines that aren't rewritten show up as moved in git show --color-moved --color-moved-ws=allow-indentation-change but I suggest reviewing the new implementation de novo.
| * tor-netdoc: VoteAuthoritySection: promote poc to prodIan Jackson2026-04-272-50/+1
| | | | | | | | | | | | | | | | | | | | | | Almost entirely code motion. Review with --color-moved. This is new correct for votes, and uses the non-poc names for things. We'll improve up a few minor things in a moment. The cfg situation is getting very tangled. There are already various TODOs about this. I think it is time to bite the bullet; I will do that separately from this MR.
| * tor-netdoc: VoteAuthoritySection: promote poc to prod (prep, use's)Ian Jackson2026-04-272-3/+5
| | | | | | | | | | Prepare for the namespace environment in the mainline doc/netstatus modules. (Add a couple of temporary use's.)
| * tor-netdoc: VoteAuthoritySection: promote poc to prod (prep, rename)Ian Jackson2026-04-271-5/+7
| | | | | | | | | | | | | | | | | | | | We are going to move this code to the main doc/netstatus modules. Rename the struct and its associated derive macro, to the naming approach used outside poc. We leave a `use` behind in poc. That can remain until poc is eventually abolished.
| * tor-netdoc: VoteAuthoritySection: deindent NddAuthoritySectionIan Jackson2026-04-271-42/+42
| | | | | | | | | | Purely whitespace change: deindent certain lines by 4. `git show -w` is helpful.
| * tor-netdoc: VoteAuthorityEntry: replace in poc with new proper typeIan Jackson2026-04-272-23/+15
| | | | | | | | | | | | This has a side effect of testing the parsing. (Testing of the encoding will have to come a lot later.)
| * tor-netdoc: ItemValueParseable: Tolerate non-snake-case fieldsIan Jackson2026-04-271-0/+1
| | | | | | | | We'll want this with Constructor's __non_exhaustive.
* | tor-netdoc: Add a TODO re VerifyFailedIan Jackson2026-04-271-1/+1
|/
* tor-netdoc: Introduce RetainedOrderVec parse/encode typeIan Jackson2026-04-231-0/+23
|
* tor-netdoc: impl conversions from tor-checkable errors to VerifyFailedIan Jackson2026-04-231-0/+17
|
* tor-netdoc: Un-gate parse2 and encode coreIan Jackson2026-04-231-1/+0
|
* Merge branch 'parse2-more-debug' into 'main'Clara Engler2026-04-212-16/+142
|\ | | | | | | | | Add debugging support to ItemValueParseable derive See merge request tpo/core/arti!3881
| * tor-netdoc: Add debugging to ItemValueParseable, demo in testIan Jackson2026-04-131-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With cargo test --all-features -p tor-netdoc -- --no-capture test2 the output now contains, amongst many other things: netdoc TestItem parse: item start, "test-item", "N", Some("TEST OBJECT") netdoc TestItem parse: field needed, normal, args=1, "N" netdoc TestItem parse: field optional, normal, args=Option<_>, "" netdoc TestItem parse: field rest, normal, args=Vec<_>, "" netdoc TestItem parse: field object, object, object=1, Some(("TEST OBJECT", Ok(5))) netdoc TestItem parse: item complete Ok
| * tor-netdoc: Add debugging to ItemValueParseableIan Jackson2026-04-131-1/+16
| |
| * tor-netdoc: parse2 derives: use NetdocParseAnyCommon in ItemValueParseableIan Jackson2026-04-131-2/+1
| | | | | | | | So far this just abolishes a duplicate P.
| * tor-netdoc: parse2 derives: Break out NetdocParseAnyCommonIan Jackson2026-04-131-13/+21
| | | | | | | | | | | | | | We're going to want tio reuse dtrace from here in the ItemValueParseable derive (which doesn't use NetdocSomeItemsParseableCommon because it derives for one item type, not a document containing multiple items).
| * tor-netdoc: parse2: with debug for items parsing, show multiplicityIan Jackson2026-04-131-0/+1
| |
| * tor-netdoc: parse2 multiplicity: Add debugging methods to traitsIan Jackson2026-04-131-0/+99
| |
* | tor-netdoc: Support `#[deftly(netdoc(skip))]` in itemsIan Jackson2026-04-201-0/+7
| | | | | | | | Ie for "arguments" that don't actually appear.
* | Merge branch 'p2-misc-exactly-1' into 'main'Clara Engler2026-04-201-2/+5
|\ \ | | | | | | | | | | | | tor-netdoc: derives: Three small improvements See merge request tpo/core/arti!3887
| * | tor-netdoc: derives: Expect an intro itemIan Jackson2026-04-141-0/+1
| | | | | | | | | | | | | | | | | | This can't trigger, but when messing about with some new features, I messed up and got a syntax error here. Let's try this feature out, here.
| * | tor-netdoc: derives: Reformat a long lineIan Jackson2026-04-141-2/+4
| |/ | | | | | | No functional change.
* / tor-netdoc: parse2: Fix error for invalid item argumentIan Jackson2026-04-141-1/+1
|/ | | | When we can't parse a NormalItemArgument, that's Invalid, not Missing.
* Merge branch 'netdoc-test-fix' into 'main'Clara Engler2026-04-081-2/+2
|\ | | | | | | | | Fix the testdata2 situation See merge request tpo/core/arti!3861
| * tor-netdoc: Fix broken poc testsClara Engler2026-04-081-2/+2
| | | | | | | | | | | | | | | | | | | | These tests got broken due to the replacement of the testdata. The changes required to make them work again were trivial, namely to increase a timestamp by two hours in a consensus, as the new consensus has a `valid-after 2000-01-01 00:02:20` followed by a fingerprint replacement for a directory authority because the authority identity keys were obviously also rotated.
* | Merge branch 'netdoc-fixes' into 'main'Clara Engler2026-04-081-1/+6
|\ \ | | | | | | | | | | | | tor-netdoc: Three fixes to parsing and encoding See merge request tpo/core/arti!3862
| * | tor-netdoc: Fix handling of netdoc(skip) in NetdocParseableFieldsIan Jackson2026-04-071-1/+6
| |/
* | tor-netdoc: parse2/encode derive: Show unquoted attributes in the docsIan Jackson2026-04-072-8/+8
| |
* | tor-netdoc: parse2/encode derive: Use meta_quoted rigorousIan Jackson2026-04-072-7/+7
|/ | | | | | | | | | | The `doctype_for_error` attribute needs immediate adjustment, because a string expression value is expected. With `quoted retain`, that would be re-interpreted, silently. This kind of thing is why `quoted rigorous` exists. So change its docs and the one use site. The macros' docs, and the other calls ites, we'll deal with shortly.
* tor-netdoc: Use Curve25519Public for parsingClara Engler2026-04-021-16/+0
| | | | | | This commit removes the implementation of ItemArgumentParseable for curve25519::PublicKey in favor of using the already existing Curve25519Public, which also got beefed up slightly.
* tor-netdoc: ItemArgumentParseable for Arc<T>Clara Engler2026-04-021-0/+6
|
* tor-netdoc: Make X25519 PKs parseable with parse2Clara Engler2026-04-021-0/+16
|
* tor-netdoc: parse2 derive: Use $/// deftly feature in a few placesIan Jackson2026-04-011-4/+4
| | | | No change to the generated docs.
* tor-netdoc: Abolish poc::authcertIan Jackson2026-04-015-10/+8
| | | | | | This was just some type aliases. Put them in the poc files that used them. (These type aliases are undesirable but we aren't cleaning them up because the whole of poc is destined for deletion.)
* tor-netdoc: Replace AuthCert::verify_selfcert implIan Jackson2026-04-011-46/+0
| | | | | Get rid of the version in poc. Instead, implement the same functionality in terms of AuthCert::verify, outside poc.
* tor-netdoc: Move raw_data_object to new container moduleIan Jackson2026-04-011-10/+0
| | | | This will allow us to use it for encoding as well as parsing.
* tor-netdoc: Fix typo in doc commentIan Jackson2026-03-311-1/+1
|
* tor-netdoc: Rename `AuthCertUnverified::verify_self_signed`Ian Jackson2026-03-311-0/+2
| | | | | | | | | | | This method verifies all the signatures, and checks that the signing authority is in the provided list. Anyway, authcerts aren't really self-signed: they're a signature by KS_auth_id_rsa on KP_auth_sign_rsa. Note that there is also a `verify_selfcert` method which does only some of the checks, and has some code duplication. That will be cleaned up later.
* Revert "parse2: Rename lno_for_error to lno"Clara Engler2026-03-251-2/+2
|
* parse2: Rename lno_for_error to lnoClara Engler2026-03-251-2/+2
| | | | | This commit lno_for_error in ItemStream to lno because its value may not always be used for error handling, such as in tor-consdiff.
* parse2: Implement `ParseError::new()`Clara Engler2026-03-251-0/+19
| | | | | | | | | This commit adds the ParseError::new() method, which allows external APIs to construct a ParseError, which is currently not possible due to non-exhaustiveness, despite the member fields being public. It is required for external applications using lower-level but public parse2 APIs, such as ItemStream's.
* Fix typosTobias Stoeckmann2026-03-246-9/+9
| | | | Typos found with codespell
* tor-netdoc: signature orderliness: add some xrefsIan Jackson2026-03-192-1/+6
|
* tor-netdoc: signature ordering: discuss an alternative impl approachIan Jackson2026-03-191-0/+3
| | | | Suggested-by: Clara Engler <[email protected]>
* tor-netdoc: signature orderliness: orderly signs don't cover other sigsIan Jackson2026-03-191-0/+1
| | | | | This is implied by `body` being the body before the first signature item, but needs to be part of the definition.
* tor-netdoc: signature orderliness: shuffle wording slightlyIan Jackson2026-03-191-1/+1
|