summaryrefslogtreecommitdiff
path: root/crates/tor-netdir
Commit message (Collapse)AuthorAgeFilesLines
* Bump crate versions in preparation for Arti 1.0.0 release.Nick Mathewson2022-09-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because we want to work more on ensuring that our semver stability story is solid, we are _not_ bumping arti-client to 1.0.0 right now. Here are the bumps we _are_ doing. Crates with "minor" bumps have had API breaks; crates with "patch" bumps have had new APIs added. Note that `tor-congestion` is not bumped here: it's a new crate, and hasn't been published before. ``` tor-basic-utils minor fs-mistrust minor tor-config minor tor-rtcompat minor tor-rtmock minor tor-llcrypto patch tor-bytes patch tor-linkspec minor tor-cell minor tor-proto minor tor-netdoc patch tor-netdir minor tor-persist patch tor-chanmgr minor tor-guardmgr minor tor-circmgr minor tor-dirmgr minor arti-client minor arti-hyper minor arti major arti-bench minor arti-testing minor ```
* enable doc_auto_cfg feature on every crate when documenting for docs.rstrinity-1686a2022-08-242-0/+4
|
* tor-netdoc: if_ito: Add expansion of acronymIan Jackson2022-08-171-0/+2
|
* tor-netdir: testnet: construct_custom_netdir_with_params: Fix docIan Jackson2022-08-171-1/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826168
* tor-netdir, testnet: Provide construct_custom_netdir_with_paramsIan Jackson2022-08-161-2/+16
| | | | | We're going to want this for testing netdirs with padding parameters that diff ere from the spec's default.
* tor-congestion: implement the RTT estimation algorithm from prop#324eta2022-08-111-0/+21
| | | | | | | | | | | This commit implements the round-trip-time estimation algorithm from Tor proposal 324, validating the implementation against the test vectors found in C tor. (Note that at the time of writing, the new test vectors may not be committed to C tor yet, but they will be soon.) This also adds the necessary consensus parameters to `NetParameters`. Some of them have been renamed in order to (hopefully) make them more understandable.
* Merge branch 'main' into 'linkspec_refactor_v3'Nick Mathewson2022-08-103-0/+24
|\ | | | | | | # Conflicts: # crates/tor-netdir/semver.md
| * Finish implementation of params() for DirMgr.Nick Mathewson2022-08-022-0/+23
| | | | | | | | | | | | | | Now it maintains an up-to-date set of default parameters to be handed out if there is no directory. Closes #528.
| * Add params() method to NetDirProvider, and partial implementationNick Mathewson2022-08-021-0/+1
| | | | | | | | | | | | | | | | This method will let users get the latest `NetParameters`, with user-configured overrides, even if there is no current directory at all. Part of #528
* | tor-netdir: Add a static assertion about RelayIdType::COUNTNick Mathewson2022-08-102-2/+6
| | | | | | | | | | | | | | Doing this will make sure that we fix a correctness issue in netdir that will be caused if we add more IDs. (Also add RelayIdType::COUNT in tor-linkspec.)
* | netdir: remove long-unused missing_descriptor_for codeNick Mathewson2022-08-102-23/+2
| |
* | tor-netdir: Remove or hide some no-longer-used accessors.Nick Mathewson2022-08-101-29/+13
| | | | | | | | | | The hidden ones are only used to implement higher-level accessors; the others are not used at all.
* | tor-netdir: Collapse by_id and by_relay_id into a single fn.Nick Mathewson2022-08-101-49/+58
| | | | | | | | | | | | There are some downstream changes required for this to work, but they are all just unit tests that could no longer infer the type of an Ed25519 key.
* | Final (?) API revisions for tor-linkspecNick Mathewson2022-08-101-25/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this change, each individual identity type becomes optional. The functions that expose them unconditionally are now in a "legacy" trait that only some downstream types are expected to implement. There are new convenience APIs in HasRelayIds: * to return Option<&keytype>, * to see if one identity-set contains another. This commit will break several downstream crates! For the reviewer's convenience, I will put the fixes for those crates into a series of squash! commits on this one. tor-netdir ---------- Revise tor-netdir to accept optional identities. This required some caveats and workarounds about the cases where we have to deal with a key type that the tor-netdir code does not currently recognize at all. If we start to add more identity types in the future, we may well want more internal indices in this code. tor-proto --------- In order to make tor-proto support optional identities, there were fewer changes than I thought. Some "check" functions needed to start looking at "all the ids we want" rather than at "the two known IDs"; they also needed to accommodate that case where we don't have an ID that we demand. This change will also help with bridges, since we want to be able to connect to a bridge without knowing all of its IDs up front. The protocol currently _requires_ the two current ID types in some places. To deal with that, I added a new `MissingId` error. I also removed a couple of unconditional identity accessors for chanmgr; code should use `target().identity(...)` instead. tor-chanmgr ----------- This is an incomplete conversion: it does not at all handle channel targets without Ed25519 identities yet. It still uses those identities to index its internal map from identity to channel; but it gives a new `MissingId` error type if it's given a channel target that doesn't have one. We'll want to revise the map type again down the road when we implement bridges, but I'd rather not step on the channel-padding work in progress right now. tor-guardmgr ------------ This change is mostly a matter of constructing owned identity types more sensibly, rather than unwrapping them directly. There are some places marked with TODOs where we still depend on particular identity types, because of how the directory protocol works. This will need revisiting when we add bridge support here. tor-circmgr ----------- These changes are just relatively simple API changes in the tests.
* | netdir: Add and use a new ids_listed() function.Nick Mathewson2022-08-021-0/+9
| |
* | netdir: add an accessor that takes a HasRelayIds.Nick Mathewson2022-08-021-1/+12
| |
* | tor-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-022-2/+7
|/ | | | | | | | | | | | | | We want the set of identities supported by a relay to be extensible in the future with minimal fuss; we'd also like to make working with these ID sets more convenient. To handle that, this commit adds a new trait for "Something that has the same IDs as a relay" and a new object for "an owned representation of a relay's IDs." This commit introduces a similar trait for "Something with a list of SocketAddr, like a relay has." There's no owned equivelent for that, since Vec<SocketAddr> is already a thing. Closes #428.
* Now that versions have bumped, remove semver.md files.Nick Mathewson2022-08-011-4/+0
|
* Bump patch versions on crates that have new APIs.Nick Mathewson2022-08-011-2/+2
| | | | | | | | | | | | | | Do _not_ bump the dependency versions on crates that have had no changes since arti 0.0.5, since those crates do not depend on the new APIs. ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p tor-llcrypto --bump patch git restore crates/tor-checkable git restore crates/tor-consdiff git restore crates/tor-rtmock ```
* Bump minor version on crates with deps with breaking changes.Nick Mathewson2022-08-011-3/+3
| | | | | | | | | | | | | | | This performs the transitive closure of the last operation: everything that depends on a crate with a breaking change gets the version which it depends on bumped. ``` cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump minor cargo set-version -p arti-hyper --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor cargo set-version -p tor-config --bump minor ```
* Bump minor versions on all crates that have had breaking changes.Nick Mathewson2022-08-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | Done with these commands: ``` cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-linkspec --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump minor cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump minor cargo set-version -p tor-dirclient --bump minor cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump minor cargo set-version -p arti --bump minor ```
* Fix a rustdoc link in tor-netdir.Nick Mathewson2022-07-261-1/+1
|
* tor-netdir: Remove latest_netdir method.Nick Mathewson2022-07-262-10/+1
|
* Add new APIs to NetDirProvider to better support timeliness.Nick Mathewson2022-07-264-3/+81
| | | | | | | | | | | | | | | | | Over the years we've found that most callers who want a netdir want what C Tor calls a "reasonably live" network directory: One that is not expired by too much, or too far in the future. But a few want a _strictly_ live directory: one that says it is valid now, with no tolerances. And a few want _any_ directory, no matter how expired it is. This commit adds net methods to NetDirProvider to provide these directories. I think that most use cases will want to explicitly think about what kind of directory they want, so I've made `netdir` the simplest method. I might remove `timely_netdir` by the end of this branch; see TODO comments. Part of #518.
* netdir: Make pick() functions take FnMut closures.Nick Mathewson2022-07-122-2/+3
| | | | | | There's no reason to enforce their being Fn closures, and allowing them to be FnMut allows us to count which filters make us rejected given relays.
* Remove semver.md files now that 0.5.0 is outNick Mathewson2022-06-241-2/+0
|
* Bump crate and dependency versions.Nick Mathewson2022-06-241-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were done with the following commands: ``` cargo set-version -p tor-basic-utils --bump patch cargo set-version -p fs-mistrust --bump minor cargo set-version -p tor-error --bump patch cargo set-version -p tor-config --bump patch cargo set-version -p tor-units --bump patch cargo set-version -p tor-rtcompat --bump minor cargo set-version -p tor-llcrypto --bump patch cargo set-version -p tor-bytes --bump minor cargo set-version -p tor-socksproto --bump minor cargo set-version -p tor-cert --bump minor cargo set-version -p tor-cell --bump minor cargo set-version -p tor-proto --bump minor cargo set-version -p tor-netdoc --bump patch cargo set-version -p tor-netdir --bump minor cargo set-version -p tor-persist --bump patch cargo set-version -p tor-chanmgr --bump minor cargo set-version -p tor-guardmgr --bump minor cargo set-version -p tor-circmgr --bump patch cargo set-version -p tor-dirclient --bump patch cargo set-version -p tor-dirmgr --bump minor cargo set-version -p arti-client --bump patch cargo set-version -p arti --bump minor cargo set-version -p arti-bench --bump minor cargo set-version -p arti-testing --bump minor ```
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* channel padding: Use IntegerMilliseconds in netdirIan Jackson2022-06-211-8/+8
|
* tor-netdir: Make CHANNEL_PADDING_TIMEOUT_UPPER_BOUND pubIan Jackson2022-06-211-1/+1
| | | | We need this because it is a type parameter for the types of nf_ito_*.
* channel padding: Change timeout to match C TorIan Jackson2022-06-211-1/+6
| | | | Pending an official value from the spec.
* channel padding: Add the parameters from the spec to NetDirIan Jackson2022-06-211-0/+28
|
* Merge branch 'reachable_addrs_v2' into 'main'Nick Mathewson2022-06-171-1/+1
|\ | | | | | | | | | | | | Implement support for reachable_addrs Closes #491 and #93 See merge request tpo/core/arti!583
| * Remove some outdated comments.Nick Mathewson2022-06-171-1/+1
| | | | | | | | | | These all say, in one form or another, "there is no guard filtering; there is only one selection". That's now false.
* | Upgrade to float_eq 1.0.0Nick Mathewson2022-06-161-1/+1
|/
* Merge branch 'high-level-features' into 'main'Nick Mathewson2022-06-161-0/+2
|\ | | | | | | | | | | | | Add "full" and "experimental" features to arti, arti-client, and below. Closes #499 See merge request tpo/core/arti!584
| * Add "full" and "experimental" features to arti-client and below.Nick Mathewson2022-06-101-0/+2
| | | | | | | | | | | | | | | | | | The "full" feature is a catch-all for all features, _except_: * Those that select a particular implementation (like tor-llcrypto/with-openssl) or build flag (like "static") * Those that are experimental or unstable (like "experimental-api") * Those that are testing-only.
* | tor-netdir: testnet: Make construct_netdir infallibleIan Jackson2022-06-132-5/+5
|/ | | | | This is a *lot* of unwraps. The function takes no parameters and is used only for testing. It ought to be infallible.
* Merge branch 'use-testing-rng'Nick Mathewson2022-06-074-75/+39
|\
| * Rewrite tests in tor-netdir to use testing_rng()Nick Mathewson2022-06-023-76/+36
| | | | | | | | | | | | | | | | | | | | | | The randomized tests in this crate take a lot of iterations to converge, so they default to using a deterministic PRNG seed with few iterations and higher tolerance, and they only randomize the tests (with more iterations and tighter tolerances) when you explicitly opt in to randomization. (If you specify a seed explicitly, you're doing that to reproduce a randomized case, so we use the same behavior.)
| * Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-023-1/+5
| | | | | | | | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* | Make NetDirProvider require Send and Sync.Nick Mathewson2022-06-072-1/+3
| | | | | | | | | | | | | | | | Our own code is the only stuff that consumes NetDirProvider, and all the code that consumes it wants it to be Send and Sync. Making this change avoids our having to define a new function to upcast Arc<dyn Foo> to Arc<dyn NetDirProvider + Send + Sync>.
* | Add an upcast_arc function to NetDirProvider.Nick Mathewson2022-06-021-1/+27
| | | | | | | | | | | | | | | | This uses some apparently-standard trickery to implement a function that lets us upcast from Arc<dyn Subtrait> to Arc<dyn Supertrait>. I considered as alternatives `as_dyn_trait` and `cast_dyn_object`. Both were nice, but generated a far larger interface than this.
* | lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | | | | | | From running add_warning, with manual picking of the right hunks/lines.
* | lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
|/ | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* Lexically sort Cargo.toml dependenciesOrhun Parmaksız2022-05-281-10/+9
| | | | | | Utilize cargo-sort: https://github.com/DevinR528/cargo-sort Signed-off-by: Orhun Parmaksız <[email protected]>
* Regenerate version bump from previous commit.arti-v0.4.0Nick Mathewson2022-05-271-2/+2
| | | | | | | This commit was made by reverting the previous commit, then re-running the script I used to generate it. In theory there should be no semantic changes: only changes due to improved formatting from cargo edit.
* Semantic version changes for Arti 0.4.0 releaseNick Mathewson2022-05-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | I followed the following procedure to make these changes: * I used maint/changed_crates to find out which crates had changed since 0.3.0. * I used grep and maint/list_crates to sort those crates in topological (dependency) order. * I looked through semver_status to find which crates were listed as having semver-relevant changes (new APIs and breaking changes). * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no changes. For those crates, I incremented their patch-level version _without_ changing the version that other crates depend on. * I scanned through the git logs of the crates with no semver-relevant changes listed to confirm that, indeed, they had no obvious breaking changes. * I treated all crates that depend on `arti` and/or `arti-client` as having breaking changes. * I identified crates that depend on crates that have changed, even if they have not changed themselves, and identified them as having a non-breaking change. * For all of the crates, I used `cargo set-version -p $CRATE --bump $STATUS` (where `STATUS` is `patch` or `minor`) to update the versions, and the depended-upon versions.
* Bump versions of trivially-changed crates.Nick Mathewson2022-05-271-1/+1
| | | | | | | | | | | | | | | | | | | These crates had only clippy fixes that do not affect their behavior: tor-bytes tor-cell tor-events tor-linkspec tor-netdir tor-socksproto This crate only had the cargo-husky dependency removed, which does not affect compatibility: tor-llcrypto Since these changes have no compatibility effects, it is not necessary to bump the versions of these crates which other crates depend on.
* Resolve the new `derive_partial_eq_without_eq` lint.Nick Mathewson2022-05-231-1/+1
| | | | It's a little overzealous sometimes, but it's mostly to the good.