aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | tor-netdoc: Constify VALID_SYSTEM_TIMEClara Engler2026-04-081-0/+5
| | | | | | | | | | | | | | | | | | This commit constifies VALID_SYSTEM_TIME, a timestamp indicating a point in time at which the certificate is valid. We will need this to test timestamp validation.
| * | tor-netdoc: Update test vectors in dir_auth_certClara Engler2026-04-081-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit replaces the longclaw test vectors in dir_auth_cert with the ones we constified previously and represent the ones found in testdata2/. It may look a bit odd that we replaced the file includes for the public keys but this is because those files should have never existed in testdata2/ in the first place and were only added by accident, meaning that the current approach is the correct one.
| * | tor-netdoc: Remove outdated longclaw comment in testClara Engler2026-04-081-2/+0
| | |
| * | tor-netdoc: Replace a File::open with include_strClara Engler2026-04-081-7/+2
| | | | | | | | | | | | | | | This commit replaces a File::open with the AUTHCERT_RAW constant in the dir_auth_cert test because that is obviously less error prone.
| * | tor-netdoc: Constify the raw authcert test vectorClara Engler2026-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | This commit adds `const AUTHCERT_RAW` which `include_str`'s the actual raw authcert we will use for parsing test purposes. The reason for that being that a single include_str! of the same file is obviously better than multiple ones.
| * | tor-netdoc: Constify the authcert test vectorsClara Engler2026-04-081-0/+41
| | | | | | | | | | | | | | | This commit constifies the authcert test vectors by extracting them from testdata2/keys/authority_certificate.
| * | tor-netdoc: Add to_rsa_id() helper functionClara Engler2026-04-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a to_rsa_id() helper function to the authcert tests in order to convert a hex-encoded RSA identity to an RsaIdentity. It will be required later on for converting the test vector values to the inner representations and this function is helpful here because it avoids us to do repetitive unwrapping and RsaIdentity::from_hex calls, which overall increase the length/readability.
| * | tor-netdoc: Add pem_to_rsa_pk helper functionClara Engler2026-04-081-0/+7
| | | | | | | | | | | | | | | | | | | | | This commit adds the pem_to_rsa_pk helper function to the authcert tests in order to convert a PEM encoded RSA public key to the internal data structure. It will be required later on in order to convert the test vector strings to internal representations.
| * | tor-netdoc: Add to_system_time helper functionClara Engler2026-04-081-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | This commit adds a to_system_time helper function accepting an &str in the Iso8601TimeSp format and converting it to a SystemTime to the authcert test cases. It will be required later on in order to conveniently convert human readable timestamps to the test vectors expected from parsed data.
| * | 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 'normal-item-arg-ip-addr' into 'main'Ian Jackson2026-04-081-0/+2
|\ \ | | | | | | | | | | | | tor-netdoc: impl NormalItemArgument for IpAddr See merge request tpo/core/arti!3867
| * | tor-netdoc: impl NormalItemArgument for IpAddrIan Jackson2026-04-081-0/+2
| |/ | | | | | | | | | | | | | | | | | | I want this for `dir-source` in authority entries in netstatus docs. According to the spec that's an "IP address" which ought to include v6, and indeed the type in Arti right now is IpAddr. The implication of this is that we don't think that anywhere in the Tor netdocs has a v4 or v6 address, without port, where the v6 address in square brackets.
* | Merge branch 'netdoc-fixes' into 'main'Clara Engler2026-04-083-3/+8
|\ \ | | | | | | | | | | | | tor-netdoc: Three fixes to parsing and encoding See merge request tpo/core/arti!3862
| * | tor-netdoc: Constructor: Produce better error when field isn't DefaultIan Jackson2026-04-071-1/+1
| | | | | | | | | | | | | | | The type error's span now points at the field type, rather than into the macro.
| * | tor-netdoc: encoding: Fix a Result to be $P::ResultIan Jackson2026-04-071-1/+1
| | |
| * | tor-netdoc: Fix handling of netdoc(skip) in NetdocParseableFieldsIan Jackson2026-04-071-1/+6
| |/
* | tor-netdoc: parse2/encode derive: Use unquoted attributes at call sitesIan Jackson2026-04-076-18/+18
| |
* | tor-netdoc: parse2/encode derive: Show unquoted attributes in the docsIan Jackson2026-04-073-11/+11
| |
* | tor-netdoc: parse2/encode derive: Use meta_quoted rigorousIan Jackson2026-04-073-11/+11
| | | | | | | | | | | | | | | | | | | | | | 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: Constructor derive: Use meta_quoted rigorousIan Jackson2026-04-072-4/+4
|/
* tor-netdoc: Add TODO to test ignoringClara Engler2026-04-021-0/+1
|
* tor-netdoc: Disable broken test for nowClara Engler2026-04-021-0/+1
|
* tor-netdoc: Note on hardcoded test vectorsClara Engler2026-04-021-0/+5
|
* tor-netdoc: Fix typo in commentClara Engler2026-04-021-1/+1
|
* tor-netdoc: Some comment improvementsClara Engler2026-04-021-2/+4
| | | Co-authored-by: Ian Jackson
* tor-netdoc: Replace if by exhaustive matchClara Engler2026-04-021-2/+4
|
* tor-netdoc: Rename Wrapper to RawPortPolicyClara Engler2026-04-021-2/+2
|
* tor-netdoc: Use PortRanges::from_str in PortPolicy::from_strClara Engler2026-04-021-4/+1
|
* tor-netdoc: Document that an overflow is impossibleClara Engler2026-04-021-0/+4
| | | | | | This commit documents that a u16 overflow in a certain branch is impossible due to the properties of a BTreeSet over which an iteration takes place.
* tor-netdoc: Remove interval tree referenceClara Engler2026-04-021-1/+1
|
* tor-netdoc: Clarifications and commentsClara Engler2026-04-021-3/+7
| | | Co-authored-by: Ian Jackson
* tor-netdoc: Private fields in PortRangeClara Engler2026-04-021-2/+2
| | | | Callers now have to use PortRange::new which checks the input.
* tor-netdoc: TODO for PortRanges rewriteClara Engler2026-04-021-0/+2
|
* tor-netdoc: Rename PortRanges::push to push_orderedClara Engler2026-04-022-5/+5
|
* tor-netdoc: Document PortRanges invariantsClara Engler2026-04-021-0/+4
|
* tor-netdoc: Remove onion_key accessorClara Engler2026-04-021-5/+0
|
* tor-netdoc: Fix conditional compilation in testClara Engler2026-04-021-0/+1
|
* tor-netdoc: Tests for the PortPolicy refactoringClara Engler2026-04-022-0/+86
|
* tor-netdoc: parse2 for PortPolicyClara Engler2026-04-021-100/+57
| | | | | | | | | | | | | | | | This commit refctors PortPolicy to use the new PortRanges, alongside removing the now duplicate code. The new PortPolicy implements ItemValueParseable, which makes it possible to nicely parse it. Unfortunately, we cannot derive it directly, because we do not store the RuleKind but instead parse it and then invert the ranges in order to save space. However, internally this is derived using a wrapper type from which we extract from. The old FromStr implementation continues to be as bad as it has always been because improving it would likely introduce more bugs than it would solve, given that the legacy implementation has been there since forever basically.
* tor-netdoc: Copy Vec<PortRange> into own typeClara Engler2026-04-021-1/+143
| | | | | | | | | | | | | This commit copies the logic found in portpolicy.rs into its parent module, namely into a type called PortRanges. Most of the code was copied one by one, with only slight adjustments having been done. The compression and inversion logic is the same though. The purpose of this is to implement ItemArgumentParseable on this, which is not really possible with a Vec<PortRange> because the port policies have a weird format: Semantically they consist of multiple arguments (i.e. multiple port ranges) but syntactically they are encoded as a single netdoc argument, because there are no spaces in between.
* tor-netdoc: NormalItemArgument for RuleKindClara Engler2026-04-021-1/+7
|
* tor-netdoc: Move RuleKind to upper moduleClara Engler2026-04-022-12/+14
| | | | | This commit moves RuleKind from addrpolicy to policy because it is also required for port policies.
* tor-netdoc: Fix exhaustive warningsClara Engler2026-04-021-1/+4
|
* tor-netdoc: Export 25519 typesClara Engler2026-04-022-2/+3
|
* tor-netdoc: Use Curve25519Public for parsingClara Engler2026-04-024-36/+22
| | | | | | 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: Refactor Ed25519IdentityLineClara Engler2026-04-022-39/+48
| | | | | This commit refactors Ed25519IdentityLine by deriving as much as possible.
* tor-netdoc: Improve on Ed25519PublicClara Engler2026-04-021-19/+18
| | | | | This commit improves on Ed25519Public to be parseable via parse2 as well as reducing redundancy by utilizing FixedB64.
* tor-netdoc: Use proper PEM parser for testvecsClara Engler2026-04-021-21/+26
| | | | | | | | | This commit uses a proper PEM parser as a dev-dependency to tor-netdoc for parsing PEM entries, instead of hard-coding long DER byte strings. It is better to use an external crate for this here, rather than the existing somewhat accessible (only through traits) implementation of parse2, because it feels wrong testing parse2 with parse2.
* tor-netdoc: Reorder Microdesc according to specClara Engler2026-04-021-11/+11
|
* tor-netdoc: Properly parse mutliple family-idsClara Engler2026-04-023-16/+40
| | | | | | | | | | | | | This commit fixes a bug in the microdescriptor parser to properly parse multiple family-ids. Previously, we interpreted the spec to simply contain multiple `family-ids` lines. This is wrong however. Instead, there may only be a single such line with multiple values. To fix this issues, we itnroduce a `RelayFamilyIds` type, similar to `RelayFamily`, that stores multiple `RelayFamilyId` entires in a `Vec`. Then, we just derive `ItemValueParseable` on it and win.