aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/doc/routerdesc.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-netdoc: Add ItemValueEncodable for RelayPlatformClara Engler2026-06-161-0/+13
| |
* | tor-netdoc: Implement ItemValueParseable instead for RelayPlatformClara Engler2026-06-161-4/+6
|/ | | | | ItemArgumentParseable does not make much sense because the field is effectively a free-form field similar to ContactInfo.
* tor-netdoc: Add RouterDesc::hidden_serive_dirClara Engler2026-06-111-0/+12
| | | | | Adds RouterDesc::hidden_service_dir as well as an accompanying ZST token.
* tor-netdoc: Replace bool with ItemPresent in RouterDesc (fmt)Clara Engler2026-06-111-1/+2
| | | | No functional change.
* tor-netdoc: Replace bool with ItemPresent in RouterDescClara Engler2026-06-111-4/+14
| | | | | | | | This commit modifies RouterDesc to replace all occurrences of `bool` with `Option<ItemPresent<T>>` while adding respective ZST tokens for the respective items. In this case, it adjusts caches_extra_info and tunnelled_dir_server.
* tor-netdoc: Use .verify_inner() in legacy parserClara Engler2026-06-111-15/+10
| | | | | | | | | | | | | | | | This commit changes the legacy parser to make use of the just added .verify_inner() method. For this, we replace the part that extracts crosscert_cert to only extract the inner signature and expiry timestamp, because this is what will be used ultimately. Inside this extraction, we change the parser to only obtain the KeyUnknownCert without any further checks, after which we will pass it to .verify_inner() to store the signatures and expiry date. Following this change, we now only change the places where the previous crosscert_cert was used to extract signatures and expiration dates to use the just extracted cc_sig and cc_expiry instead.
* tor-netdoc: Ed25519NtorCrossCert::verify_inner()Clara Engler2026-06-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit creates a new method, Ed25519NtorCrossCert::verify_inner(), which in essence represents a copying of the verification logic for ntor cross certificates from the legacy parser into parse2 logic, with the eventual goal to unify these two. Unfortunately, a 1:1 move using --color-moved was not possible, because the legacy parser uses edcert::UnvalidatedEdCert for this, which is a very legacy parser specific type, as it contains a Pos in its inner items. Instead, I encourage reviewers to review the functional equality between these two implementations using the following approach: 1. Open the .verify_inner() in one pane. 2. Open routerdesc.rs below the position where this commit introduces the "XXX" comment in another pane next to it; this is the lion's share of the legacy implementation of it. 3. Ensure that the properties that the legacy implementation achieves is also achieved by .verify_inner(). This may require you to take a look at UnvalidatedEdCert::check_cert_type() and similar methods and verify that the if statements in .verify_inner() are equivalent. As outlined above, we cannot make use of these methods directly ourselves inside .verify_inner(). Keep in mind that the legacy parser only returns a tor_cert::UncheckedCert, whereas .verify_inner() returns a gated type. This is okay because UncheckedCert contains these gated types inside it anyways.
* Merge branch 'fix-eventdns-todo' into 'main'Ian Jackson2026-06-101-1/+0
|\ | | | | | | | | tor-netdoc: Remove accidential TODO left-over See merge request tpo/core/arti!4081
| * tor-netdoc: Remove accidential TODO left-overClara Engler2026-06-091-1/+0
| | | | | | | | | | | | | | | | | | This commit removes an accidential TODO left-over related to eventdns, which now appears as it would refer to caches-extra-info. I must have forgotten to rebase this out after we decided to not include eventdns in arti!4006, but looking at torspec!498, it is obvious that the comment refers to eventdns and not caches-extra-info.
* | everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+1
| | | | | | | | | | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* | maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
|/ | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-netdoc: Add TODO for eventdnsClara Engler2026-06-031-0/+1
|
* tor-netdoc: Change Option<NumericBoolean> to NumericBooleanClara Engler2026-06-031-1/+2
| | | | | | It is weird to have three possible states for truthiness here. This commit removes the Option in favor of the inner type while adding a TODO comment to somehow find a way to skip this during encoding.
* tor-netdoc: Replace some item docs with spec linksClara Engler2026-06-031-6/+3
|
* tor-netdoc: Add TODO for overload_generalClara Engler2026-06-031-0/+1
| | | | Adds a TODO for using ConstantString for overload_general.
* tor-netdoc: Add extra_info_digest to RouterDescClara Engler2026-06-031-0/+8
| | | | This field is taken from the spec.
* tor-netdoc: Add contact to RouterDescClara Engler2026-06-031-0/+8
| | | | This commit adds the contact field to RouterDesc.
* tor-netdoc: Add overload_general to RouterDescClara Engler2026-06-031-0/+8
| | | | This commit adds support for the overload-general field to RouterDesc.
* tor-netdoc: Add hibernating field to RouterDescClara Engler2026-06-031-0/+8
|
* tor-netdoc: Add spec link for RelayPlatformClara Engler2026-06-021-0/+3
|
* tor-netdoc: Round-trip test for RelayPlatform encodingClara Engler2026-06-021-0/+7
|
* tor-netdoc: Implement Display for RelayPlatformClara Engler2026-06-021-0/+11
|
* tor-netdoc: Store platform of TorVersion in Option (fmt)Clara Engler2026-06-021-1/+3
| | | | No functional change, just rustfmt.
* tor-netdoc: Store platform of TorVersion in OptionClara Engler2026-06-021-7/+7
| | | | | | | | | This commit changes RelayPlatform::TorVersion to store the platform to an Option<String> instead of a String because storing a missing/not present platform as the empty String feels wrong in my opinion. Besides, we will soon need to add encoding for this type, making now a good time to change it.
* tor-netdoc: Refactor RelayPlatform testsClara Engler2026-06-021-21/+28
| | | | | | | | | | | | | | | This refactors the RelayPlatform test to store the test vectors in an array and iterate over it, comparing it with the expected output. This is a lot better than the current version, where there is not just a lot of copy and pasted code but also some tests that only check for an okay value. Unfortunately, there is not an easy way to review this with --color-moved or something. Personally, I would recommend to review each original test vector (i.e. a line starting with `let p =` followed by a string literal) and verify that the exact same string literal is still present within the new test vector. Afterwards, verifying the assertion logic should be easy, as it is a one-liner.
* tor-netdoc: Use spec comment for identity-ed25519Clara Engler2026-06-011-2/+1
|
* tor-netdoc: Small spelling fixClara Engler2026-06-011-1/+1
|
* tor-netdoc: Fix RouterDesc::ed_identity expect msgClara Engler2026-06-011-1/+1
|
* tor-netdoc: Store identity_ed25519 in EmbeddedCert logic (fmt)Clara Engler2026-06-011-1/+2
| | | | Just rustfmt.
* tor-netdoc: Store identity_ed25519 in EmbeddedCert logicClara Engler2026-06-011-4/+11
| | | | | | | | | This commit changes the tpye of `RouterDesc::identity_ed25519` to be of EmbeddedCert. Using the inner keys as the verified values is fine because the legacy parser continues to verify the legacy cert, as it extracts its timestamp and signature to the Vec it verifies in the end.
* tor-netdoc: Extract KeyUnknownCert for identity cert (fmt)Clara Engler2026-06-011-8/+6
| | | | Just rustfmt.
* tor-netdoc: Extract KeyUnknownCert for identity certClara Engler2026-06-011-4/+17
| | | | | | | | | This commit modifies the legacy parser code in an ugly way to also return a copy of the KeyUnknown certificate, which will be required for an EmbeddedCert<> construction. This is not nice but unavoidable in a setup that makes use of the self-consuming tor_cert certificate chain, like the legacy parser code.
* tor-netdoc: Add master-key-ed25519Clara Engler2026-06-011-2/+11
|
* tor-netdoc: Run rustfmtClara Engler2026-05-271-18/+11
| | | | No functional change.
* tor-netdoc: Remove virtual/real distinguishmentClara Engler2026-05-271-17/+0
| | | | | Removes a comment about the virtual/real distinguishment in RouterDesc as there are no virtual items left anymore.
* tor-netdoc: Remove family_ids from RouterDescClara Engler2026-05-271-17/+11
| | | | | | | This item is no longer required because we can extract it from family_cert. Unfortunately it requires a breaking change to the getter.
* tor-netdoc: Add family-cert to RouterDescClara Engler2026-05-271-3/+24
| | | | | | | | | | | | This commit adds the family_cert field to RouterDesc using EmbeddedCert logic. Unfortunately, it requires some code gymnastics similar to the (not yet merged) identity-ed25519 certificates, which we also outlined in a comment of a previous commit in the branch. Long story short: The legacy parser and parse2 do not like to co-exist in the same scope due to the self-consuming tor-cert verification chain of which the legacy parser makes heavy use.
* tor-netdoc: Return KeyUnknownCert for happy familiesClara Engler2026-05-271-3/+10
| | | | | | This commit modifies the legacy happy families extractor to also return KeyUnknownCert while adding a comment explaining on why this will be required.
* tor-netdoc: Split inner happy families mapClara Engler2026-05-271-3/+5
| | | | | | | | | This commit splits the inner .map() function of the happy families extractor in the legacy parser. In the next commit, we will return both of these variables separately, but for now this change has no functional change and only looks redundant.
* tor-netdoc: Move typespec in legacy parserClara Engler2026-05-271-2/+2
| | | | | We will change the type in the next commit and this will make auditing the next commits easier.
* tor-netdoc: Spec link for RouterDesc::or_addressClara Engler2026-05-271-2/+1
|
* tor-netdoc: Store or-address in a SocketAddrClara Engler2026-05-271-8/+7
| | | | | | | | | | | | | | | | | | | | | | 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: Add bandwidth field to RouterDescClara Engler2026-05-261-0/+8
| | | | | | 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: Store ntor_onion_key as Curve25519PublicClara Engler2026-05-181-4/+3
|
* tor-netdoc: Use saturating SystemTime add/sub (fmt)Clara Engler2026-05-181-2/+6
| | | | No functional change.
* tor-netdoc: Use saturating SystemTime add/subClara Engler2026-05-181-4/+3
| | | | This commit deserves no explanation, it should be the default.
* tor-netdoc: Store published in Iso8601TimeSpClara Engler2026-05-181-6/+7
|
* tor-netdoc: Add intro item to RouterDescClara Engler2026-05-181-28/+26
| | | | | | | | | | | This commit introduces `RouterDesc::router` using `RouterDescIntroItem` by moving `nickname`, `orport`, `dirport`, and `ipv4addr` into it. A notable change is that ipv4addr is no longer stored in an `Option`. I have no idea why this was the case because it has always been mandatory and never None anyways, but I suspect it was to be able to treat it as an iterator, something we can also achieve using iter::once().
* tor-netdoc: Change fingerprint to Option<SpFingerprint>Clara Engler2026-05-121-2/+2
|
* tor-netdoc: Obtain RSA identity from signing keyClara Engler2026-05-121-2/+1
| | | | | Will be required and unavoidable as we will change fingerprint to Option<SpFingerprint> in the next commit.