summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: NetdocParseableFields: Pass ItemStream to finishIan Jackson2026-05-272-5/+18
|
* tor-netdoc: Properly replace parse2::lex::NoFurtherArgumentsIan Jackson2026-05-271-12/+2
| | | | | | | | | | | | | | | 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: introduce VoteStatusConsensus and VoteStatusVoteIan Jackson2026-05-272-36/+2
| | | | | Replacing poc's. The new define_fixed_string macro is really helping here.
* tor-netdoc: NetworkStatusVersionItem, replacing poc's tupleIan Jackson2026-05-272-7/+6
| | | | | 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-271-27/+8
| | | | | | | 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-271-10/+7
| | | | | | | | 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: Replace poc's NddDirectoryFooter with new FooterIan Jackson2026-05-271-9/+7
| | | | | This is the whole of the footer section, with docs, appropriate derives, and so on.
* tor-netdoc: NetworkStatusVersion, replacing poc's with FixedStringIan Jackson2026-05-271-11/+1
|
* tor-netdoc: Document that parse2 vs encode multiplicity match req'tIan Jackson2026-05-181-0/+15
|
* tor-netdoc: Parsing with `#[netdoc(flatten)]`: cope with non-path typesIan Jackson2026-05-131-1/+1
| | | | ns_type! is a non-path type.
* tor-netdoc: Apply deferred rustfmt churnIan Jackson2026-04-291-26/+29
|
* tor-netdoc: Fix signature of hash_slice_for_verificationIan Jackson2026-04-291-9/+2
| | | | | | | In order to handle marked vs unmarked SHA1 correctly, it needs the original DigestAlgoInSignature. The only call site is in poc's verification code.
* tor-netdoc: Abolish poc's netstatus signature typeIan Jackson2026-04-291-159/+16
| | | | | | | | | | | | | | Use prod's Signature instead. This gets rid of: * The old parsing code. We have a new approach based on ItemValueParseable, KeywordOrString and and DigestAlgoInSignature. * The duplicate DirectorySignaturesHashesAccu and its temporary conversions. poc's verify_timeless function needs a little adjustment for the new struct layout.
* tor-netdoc: Promote hash_slice_for_verification to prodIan Jackson2026-04-291-13/+1
| | | | | | This function is not right, yet. We're going to fix it later. Review with --color-moved.
* tor-netdoc: Introduce DirectorySignaturesHashesAccu::update_fromIan Jackson2026-04-291-13/+12
| | | | | | | | | | | | | | | | | | This now contains the hashing code that was in poc. In poc it was entangled with the signature type, mostly because once upon a time the hash was inside the signature. In the real code we can make it a standalone method. It takes DigestAlgoInSignature so that it will be able to handle the explicit vs implicit sha1 anomaly correctly - but it can't do that yet because the necessary field doesn't exist yet. Also, we are going to want to make it a bit lazier - preserve the MR-blocking todo for that. A handful of lines are being actually moved verbatim, so --color-moved may help a bit.
* tor-netdoc: Promote poc's DirectorySignaturesHashesAccu to prodIan Jackson2026-04-291-28/+2
| | | | | | | There are definitely some things wrong with this, but they all have MR-blocking TODOs so we can promote this type now. Largely code motion. Review with --color-moved.
* tor-netdoc: Make some items temporarily pub(crate)Ian Jackson2026-04-291-2/+4
|
* tor-netdoc: Temporary conversions between the two DirectorySignatureHashAlgosIan Jackson2026-04-291-0/+20
| | | | | | Because we have two DirectorySignatureHashAlgo types because of the macrology problem, we need to introduce temporary conversions, to let us move code from poc to prod.
* tor-netdoc: netstatus signature hashing: Add TODO re wasted workIan Jackson2026-04-291-0/+1
|
* tor-netdoc: netstatus signature hashing: Add TODO re unnamed sha1Ian Jackson2026-04-291-0/+16
| | | | | We're going to fix this in this branch, as part of promoting the poc code to prod.
* tor-netdoc: netstatus signing algorithms: Improve a doc commentIan Jackson2026-04-291-1/+1
| | | | There isn't a "this" here; self is DirectorySignaturesHashesAccu.
* tor-netdoc: parse2: Improve another error span for missing trait implIan Jackson2026-04-291-1/+1
|
* tor-netdoc: parse2: Add missing ItemObjectParseable to prelude (fmt)Ian Jackson2026-04-291-2/+2
|
* tor-netdoc: parse2: Add missing ItemObjectParseable to preludeIan Jackson2026-04-291-1/+1
| | | | And remove a then-unneeded import in a using module.
* 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.