aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-netdir
Commit message (Collapse)AuthorAgeFilesLines
* Bump versions for tor-* and arti-* cratesSteven Engler2026-08-031-11/+11
| | | | | | | ```bash readarray -t bump < <(maint/list-crates | grep -P '^tor-|^arti-') for crate in "${bump[@]}"; do cargo set-version --bump minor -p "${crate}"; done ```
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-152-4/+0
|
* add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
|
* Removed unnecessary lintpryty262026-07-151-2/+1
| | | | Removed unnecessary lint
* Upgrade to itertools 0.15.0Nick Mathewson2026-07-011-1/+1
| | | | | | Additionally, fix itertools usage in maybenot_padding.rs The definition of `Position` changed in 0.15.0.
* Version bumps for 2.5.0Nick Mathewson2026-06-301-12/+12
| | | | | | | | | | | | | Closes #2617. We've lucked out this time, and it turns out that every one of our published crates gets a minor bump. So this was generated with: ``` for cr in $(./maint/list-crates); do cargo set-version -p $cr --bump minor done ```
* Merge branch 'microdesc-sha' into 'main'Clara Engler2026-06-252-15/+15
|\ | | | | | | | | tor-netdoc: Remove document hash from Microdesc struct (and add MicrodescAndHash for that) See merge request tpo/core/arti!4138
| * Remove renaming aliases for MicrodescAndHashIan Jackson2026-06-222-15/+15
| |
| * tor-netdoc: Break Microdesc up into Microdesc and MicrodescAndHashIan Jackson2026-06-222-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The Microdesc type having a copy of the document hash was always weird, and it's weirder now that there's all these parse2 types that don't have it and parse2 derives on Microdesc that don't touch it. Make a new type for the descriptor and its hash. Use deref to arrange that the new type works almost like the old one. Adjust the use lines in the dependencies to temporarily import MicrodescAndHash as Microdesc.
* | tor-netdoc: Wrap port policies in InternClara Engler2026-06-241-4/+4
|/ | | | This commit wraps the port policies in an Intern.
* Merge branch 'msrv-1.91' into 'main'gabi-2502026-06-181-1/+1
|\ | | | | | | | | Bump MSRV to 1.91 See merge request tpo/core/arti!4105
| * Bump MSRV to 1.91Clara Engler2026-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit bumps the MSRV to 1.91 which was released on 2025-10-30. The Cargo.toml files were updated as follows: ```sh git ls-files | \ grep ".*Cargo\.toml$" | \ xargs sed -i '' 's/^rust-version = "1\.89"$/rust-version = "1\.91"/g' ``` The following files were updated manually: ``` modified: .gitlab-ci.yml modified: README.md modified: flake.nix modified: maint/docker-android/Dockerfile ```
* | pick_n_weighted: change variable names for clarityJim Newsome2026-06-171-25/+25
| | | | | | | | | | | | | | "iter" wasn't an iterator per se. Changed it to "sampled_items", and renamed other variables to call the items more generically "items" than "relay", since the mixed usage was a little confusing, and the function doesn't really know anything about relays.
* | NetDir::pick_n_relays and pick_n_weighted: clarify/fix docs re zero-weight itemsJim Newsome2026-06-171-5/+7
| |
* | NetDir::pick_n_weighted: fix doc-comment to not refer toJim Newsome2026-06-171-2/+1
| |
* | Rename NetDir::pick_n_filtered_weighted -> pick_n_weightedJim Newsome2026-06-171-22/+14
| |
* | pick_n_filtered_weighted: move warnings logs to callerJim Newsome2026-06-171-3/+11
| | | | | | | | We have more useful context in the caller, `pick_n_relays`.
* | pick_n_filtered_weighted: test and fix for rand 0.10 behaviorJim Newsome2026-06-171-79/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tests our implementation of sampling to ensure the behavior is as-expected. It also updates the implementation so that the tests pass (It was broken when updating to rand 0.10; see https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3426398). This removes the direct testing of `rand::IndexedRandom::sample_weighted`, since this is now an impplementation detail of `pick_n_filtered_weighted`, which is itself tested. Verified that this fixes the case of sometimes not being able to select a Guard in integration tests. <https://gitlab.torproject.org/tpo/core/chutney/-/work_items/40057#note_3426299> <https://gitlab.torproject.org/tpo/core/arti/-/work_items/1907#note_3408157> <https://gitlab.torproject.org/tpo/core/arti/-/work_items/2209>
* | NetDir::pick_n_relays: move implementation to a testable helperJim Newsome2026-06-171-35/+60
| |
* | cargo fmtJim Newsome2026-06-171-5/+21
| |
* | Netdir::pick_n_relays: precompute weightsJim Newsome2026-06-171-19/+19
| | | | | | | | | | This should be a no-op refactor to callers. It's a step towards decoupling the weighting and filtering from the sampling.
* | test_zero: fix comment re 0-weight handlingJim Newsome2026-06-171-1/+0
| |
* | NetDir::pick_relay: update doc-comment re zero-weight handlingJim Newsome2026-06-171-1/+4
|/
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-096-0/+7
| | | | | | | | | | | | 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.
* Merge branch 'debug-weights' into 'main'Jim Newsome2026-06-011-9/+17
|\ | | | | | | | | NetDir::pick_relay: preemptively handle empty sequence See merge request tpo/core/arti!4034
| * NetDir::pick_relay: preemptively handle empty sequenceJim Newsome2026-05-271-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | The `choose_weighted` behavior given an empty sequence isn't well documented and has changed over time. Handle it ourselves for consistency. Currently, the `choose_weighted` behavior appears to be to return WeightError::InvalidInput. This means the corresponding `is_empty` branch when handling WeightError::InsufficientNonZero was never exercised. (Though may have been with previous versions of the rand crate).
* | Bump all the unstable tor- and arti- crates to 0.43.0Gabriela Moldovan2026-06-011-11/+11
|/ | | | | | | | | | Done using: ``` for crate in $(./maint/list-crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.43.0 done ```
* relay: Crypto task now listens for new consensusDavid Goulet2026-05-261-0/+9
| | | | Signed-off-by: David Goulet <[email protected]>
* netdir: Add a debug_assert to ensure the voting interval is non-zeroGabriela Moldovan2026-05-211-0/+44
| | | | | This also adds a test, just make sure creating a `Lifetime` with voting interval = 0 is actually impossible (and stays that way).
* netdir: Add a test for start_of_sr_protocol_run()Gabriela Moldovan2026-05-211-0/+77
|
* netdir: Make start_of_sr_round() fallibleGabriela Moldovan2026-05-211-10/+12
| | | | | It's better to return a `Bug` than to panic if the consensus valid-after is invalid.
* netdir: Remove a no longer needed constantGabriela Moldovan2026-05-211-3/+0
|
* netdir: Remove start_of_day_containing()Gabriela Moldovan2026-05-211-29/+0
| | | | This is no longer used.
* netdir: Fix SRV lifetime calculation for non-standard voting periodsGabriela Moldovan2026-05-211-3/+25
| | | | | | | | | | | | | | Fixes Arti's SRV lifetime calculation for the case where the voting interval != 1h, and the consensus doesn't have explicit timestamps for the SRVs. Credit goes to dgoulet for this fix! See also [this thread], and #2458 for the broader context. Closes #2522 [this thread]: https://gitlab.torproject.org/tpo/core/arti/-/work_items/2458#note_3401343
* Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-123-13/+13
| | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* release: Bump tor- and arti- crate versions.Wesley Aptekar-Cassels2026-05-061-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cargo set-version -p arti-client 0.42.0 cargo set-version -p arti-config 0.42.0 cargo set-version -p arti-relay 0.42.0 cargo set-version -p arti-rpc-client-core 0.42.0 cargo set-version -p arti-rpcserver 0.42.0 cargo set-version -p arti-testing 0.42.0 cargo set-version -p arti-ureq 0.42.0 cargo set-version -p tor-async-utils 0.42.0 cargo set-version -p tor-basic-utils 0.42.0 cargo set-version -p tor-bytes 0.42.0 cargo set-version -p tor-cell 0.42.0 cargo set-version -p tor-cert 0.42.0 cargo set-version -p tor-cert-x509 0.42.0 cargo set-version -p tor-chanmgr 0.42.0 cargo set-version -p tor-checkable 0.42.0 cargo set-version -p tor-circmgr 0.42.0 cargo set-version -p tor-config 0.42.0 cargo set-version -p tor-config-path 0.42.0 cargo set-version -p tor-consdiff 0.42.0 cargo set-version -p tor-dirclient 0.42.0 cargo set-version -p tor-dircommon 0.42.0 cargo set-version -p tor-dirmgr 0.42.0 cargo set-version -p tor-dirserver 0.42.0 cargo set-version -p tor-error 0.42.0 cargo set-version -p tor-events 0.42.0 cargo set-version -p tor-general-addr 0.42.0 cargo set-version -p tor-geoip 0.42.0 cargo set-version -p tor-guardmgr 0.42.0 cargo set-version -p tor-hsclient 0.42.0 cargo set-version -p tor-hscrypto 0.42.0 cargo set-version -p tor-hsrproxy 0.42.0 cargo set-version -p tor-hsservice 0.42.0 cargo set-version -p tor-key-forge 0.42.0 cargo set-version -p tor-keymgr 0.42.0 cargo set-version -p tor-linkspec 0.42.0 cargo set-version -p tor-llcrypto 0.42.0 cargo set-version -p tor-log-ratelim 0.42.0 cargo set-version -p tor-memquota 0.42.0 cargo set-version -p tor-memquota-cost 0.42.0 cargo set-version -p tor-netdir 0.42.0 cargo set-version -p tor-netdoc 0.42.0 cargo set-version -p tor-persist 0.42.0 cargo set-version -p tor-proto 0.42.0 cargo set-version -p tor-protover 0.42.0 cargo set-version -p tor-ptmgr 0.42.0 cargo set-version -p tor-relay-crypto 0.42.0 cargo set-version -p tor-relay-selection 0.42.0 cargo set-version -p tor-rpcbase 0.42.0 cargo set-version -p tor-rpc-connect 0.42.0 cargo set-version -p tor-rtcompat 0.42.0 cargo set-version -p tor-rtmock 0.42.0 cargo set-version -p tor-socksproto 0.42.0 cargo set-version -p tor-units 0.42.0
* geoip: Make asn data conditional.Nick Mathewson2026-04-151-1/+1
| | | | | | | | | | | | This abolishes the NetDefn type, and turns DenseRangeDb into a map to one or (optionally!) two types. For the DBs we ship, which don't have asn information, this saves about 2.5 MiB. (It also probably saves a bit more, since the niche optimization didn't apply to NetDefn as it existed before, since it tried to distinguish Some(None,None) from None.)
* geoip: Migrate code to DenseRangeMap.Nick Mathewson2026-04-151-1/+1
| | | | | This required correcting some errors in our previous ersatz geoip databases.
* NetDir::pick_relay: add a little more info to error reportsJim Newsome2026-04-021-1/+6
| | | | In particular to help debug arti#1907
* NetDir::pick_relay: add some trace loggingJim Newsome2026-04-021-1/+6
|
* hsdir_params: add debug log when we fall back to disaster paramsJim Newsome2026-04-021-2/+4
|
* Bump versions: tor-* and arti-* unstable cratesIan Jackson2026-03-301-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/2436#note_3384773 Made with nailing-cargo -Eu set-version -p arti-client 0.41.0 nailing-cargo -Eu set-version -p arti-relay 0.41.0 nailing-cargo -Eu set-version -p arti-rpcserver 0.41.0 nailing-cargo -Eu set-version -p arti-ureq 0.41.0 nailing-cargo -Eu set-version -p arti-rpc-client-core 0.41.0 nailing-cargo -Eu set-version -p tor-basic-utils 0.41.0 nailing-cargo -Eu set-version -p tor-error 0.41.0 nailing-cargo -Eu set-version -p tor-general-addr 0.41.0 nailing-cargo -Eu set-version -p tor-geoip 0.41.0 nailing-cargo -Eu set-version -p tor-memquota-cost 0.41.0 nailing-cargo -Eu set-version -p tor-llcrypto 0.41.0 nailing-cargo -Eu set-version -p tor-cert-x509 0.41.0 nailing-cargo -Eu set-version -p tor-rtcompat 0.41.0 nailing-cargo -Eu set-version -p tor-rtmock 0.41.0 nailing-cargo -Eu set-version -p tor-async-utils 0.41.0 nailing-cargo -Eu set-version -p tor-config 0.41.0 nailing-cargo -Eu set-version -p tor-config-path 0.41.0 nailing-cargo -Eu set-version -p tor-rpc-connect 0.41.0 nailing-cargo -Eu set-version -p tor-log-ratelim 0.41.0 nailing-cargo -Eu set-version -p tor-rpcbase 0.41.0 nailing-cargo -Eu set-version -p tor-memquota 0.41.0 nailing-cargo -Eu set-version -p tor-units 0.41.0 nailing-cargo -Eu set-version -p tor-bytes 0.41.0 nailing-cargo -Eu set-version -p tor-protover 0.41.0 nailing-cargo -Eu set-version -p tor-checkable 0.41.0 nailing-cargo -Eu set-version -p tor-cert 0.41.0 nailing-cargo -Eu set-version -p tor-key-forge 0.41.0 nailing-cargo -Eu set-version -p tor-hscrypto 0.41.0 nailing-cargo -Eu set-version -p tor-socksproto 0.41.0 nailing-cargo -Eu set-version -p tor-linkspec 0.41.0 nailing-cargo -Eu set-version -p tor-cell 0.41.0 nailing-cargo -Eu set-version -p tor-persist 0.41.0 nailing-cargo -Eu set-version -p tor-keymgr 0.41.0 nailing-cargo -Eu set-version -p tor-relay-crypto 0.41.0 nailing-cargo -Eu set-version -p tor-proto 0.41.0 nailing-cargo -Eu set-version -p tor-netdoc 0.41.0 nailing-cargo -Eu set-version -p tor-consdiff 0.41.0 nailing-cargo -Eu set-version -p tor-netdir 0.41.0 nailing-cargo -Eu set-version -p tor-relay-selection 0.41.0 nailing-cargo -Eu set-version -p tor-chanmgr 0.41.0 nailing-cargo -Eu set-version -p tor-ptmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dircommon 0.41.0 nailing-cargo -Eu set-version -p tor-guardmgr 0.41.0 nailing-cargo -Eu set-version -p tor-circmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirclient 0.41.0 nailing-cargo -Eu set-version -p tor-dirmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirserver 0.41.0 nailing-cargo -Eu set-version -p tor-hsclient 0.41.0 nailing-cargo -Eu set-version -p tor-hsservice 0.41.0 nailing-cargo -Eu set-version -p tor-hsrproxy 0.41.0
* Plumb web-time-compat/full dependency through everywhere.Ian Jackson2026-03-301-0/+1
| | | | As generated by maint/fixup-features.
* tor-netdir: port to web-time-compat.Nick Mathewson2026-03-263-3/+5
|
* Fix grammar typosTobias Stoeckmann2026-03-151-1/+1
|
* Fix word duplicate typosTobias Stoeckmann2026-03-152-3/+3
|
* Merge branch 'flags-url' into 'main'Clara Engler2026-03-121-0/+3
|\ | | | | | | | | tor-netdir: Add spec link to flag descriptions See merge request tpo/core/arti!3768
| * tor-netdir: Add spec link to flag descriptionsIan Jackson2026-03-111-0/+3
| |
* | tor-netdir: Simply exit documentationClara Engler2026-03-091-7/+0
| | | | | | | | No need to over-engineer this, let's keep it simple.
* | tor-netdir: Add is_flagged_exit() to RelayDetailsClara Engler2026-03-051-0/+11
|/ | | | | | | | | | | This commit adds a method called `is_flagged_exit` to `RelayDetails` in order to check whether the node is considered to be usable as an exit or not. In the Tor VPN app, we need this feature for generating a list of exit relays (per country). Right now, we do this in an incorrect way by only checking on whether port 443 is in the exit policy, which is not a sufficient criteria.