summaryrefslogtreecommitdiff
path: root/crates/tor-netdir/src
Commit message (Collapse)AuthorAgeFilesLines
* RelayFlags: Use RelayFlag enum variant names everywhereIan Jackson2025-11-183-17/+17
| | | | | | | Abolish the constants with the transitional names. This also abolishes the controversial name `H_S_DIR`, which Rust case transformation rules generated from `HSDir`.
* RelayFlags: Use the singular RelayFlag for naming individual flagsIan Jackson2025-11-183-20/+20
| | | | | | | | | | | | | | We're going to separate RelayFlag from RelayFlags. We could continue to provide a bunch of constant values for RelayFlags, for each individual type, but that would involve an ad-hoc derive, and would still be a bit of an unusual API. Instead, we're going to make ``RelayFlag` a normal enum. In this commit, we change everyone to refer to it by its singular name. Hopefully separating out this bulk change makes both this, and the core commit, easier to review.
* tor-netdoc: Remove the RelayFlags type alias in netstatusIan Jackson2025-11-183-4/+5
| | | | I would do `#[deprecated]` but empirically that has no effect...
* tor-netdoc: Rename RelayFlags elements for regularity vs specIan Jackson2025-11-182-4/+4
| | | | | Add underscores so that the spec keywords and the flag constants correspond (according to `paste`'s case-changing rules).
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-066-7/+7
| | | | Run maint/add_warning
* tor-netdoc: RouterStatus: unify `orport_addrs` and `addrs` methodsIan Jackson2025-10-061-2/+2
| | | | | | | We had two functions with different return types but identical semantics. Replace them with one function returning `impl Iterator`. Make it return owned addresses. These are small.
* tor-linkspec: Change HasAddrs::addrs to return an IteratorIan Jackson2025-10-061-4/+3
| | | | | | | | This will let us model the actual structure of routerstatus entries in netdocs more closely. They don't have the addresses in a single list. When this code was written this would have been much more awkward, but now we have RPITIT.
* Remove "doc_auto_cfg" incantation from all crates.Nick Mathewson2025-09-291-1/+1
| | | | This feature has been removed from nightly, in favor of doc_cfg.
* Merge branch 'xon-xoff-checker' into 'main'David Goulet2025-09-151-0/+33
|\ | | | | | | | | tor-proto,tor-netdir: add flow control consensus parameters See merge request tpo/core/arti!3249
| * tor-netdir: add flow control parameters to `NetParameters`Steven Engler2025-09-101-0/+33
| |
* | tor-netdir: change default `cc_alg` from 0 to 2Steven Engler2025-09-101-5/+1
|/ | | | | | | | This is fine because we still default to non-cc circuits unless the "flowctl-cc" feature is enabled. See `exit_circparams_from_netparams` and `onion_circparams_from_netparams` from `tor_circmgr::build`, where both will only call `build_cc_vegas()` if `cfg(feature = "flowctl-cc")`, and otherwise call `build_cc_fixedwindow()`.
* tor-netdir: Removed dependency on `static_assertions`hashcatHitman2025-09-011-2/+1
| | | | | | | | Replaced use of [`static_assertions::const_assert`] with the newly available "assert in const" pattern. This completely removes the dependency on `static_assertions` for `tor-netdir`. Signed-off-by: hashcatHitman <[email protected]>
* tor-netdoc: Apply much rustfmt churnIan Jackson2025-08-263-10/+5
|
* tor-netdoc: Combine ConsensusRouterStatus and GenericRouterStatusIan Jackson2025-08-263-14/+14
| | | | Now we only need one type.
* tor-netdoc: Abolish RouterStatus trait in favour of generic methodsIan Jackson2025-08-261-2/+2
| | | | | Our approach to sharing code between md and plain consensuses is now the new "variety" system, not generics.
* tor-netdoc: Remove generics from Consensus and its contentsIan Jackson2025-08-263-12/+12
|
* tor-netdoc: netstatus: Move everything variety-specificIan Jackson2025-08-263-14/+14
| | | | | | | | | This is much code motion. This splits many types into two. For example, `Conensus` is now`plain::Consensus<RS>` and `md::Consensus<RS>`. We're going to get rid of the generics later in this branch.
* clippy: fix `clippy::duplicated_attributes` warningsSteven Engler2025-08-111-1/+0
| | | | | | | | | | ```text warning: duplicated attribute --> crates/tor-hsservice/src/timeout_track.rs:630:14 | 630 | #![allow(clippy::needless_pass_by_value)] // TODO hoist into standard lint block | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
* Fix warnings and errors from edition 2024.Nick Mathewson2025-08-071-28/+20
| | | | | | | | | | The two main causes of errors were: - Since some of the lifetime rules have changed, we no longer need to do as many "bind a variable and immediately return it" patterns, and so clippy now warns about them. - We needed to adjust the explicit captures (`use<...>`) in a couple of our RPIT instances.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-074-29/+30
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* tor-hsservice: Time out RendRequests in PoW queue.Wesley Aptekar-Cassels2025-08-051-1/+0
|
* tor-hsservice: Add consensus params for Prop 362.Wesley Aptekar-Cassels2025-08-051-0/+25
| | | | | | | | | | | This adds the three new parameters specified in Prop 362 [0]. Two of these replace hardcoded defaults in the code. The third, HiddenServiceProofOfWorkV1ServiceIntroTimeoutSeconds, is not implemented yet, but will be in a future commit. [0]: https://spec.torproject.org/proposals/362-update-pow-control-loop.html
* Fix errors from rustdoc nightly.Nick Mathewson2025-08-051-1/+1
|
* Merge branch 'prop360-combined' into 'main'Nick Mathewson2025-07-101-0/+10
|\ | | | | | | | | | | | | Implement proposal 360 (limit HsDesc inflation opportunities) Closes #2046 See merge request tpo/core/arti!3070
| * Suggestions from @gabi-250 on prop360 implementation.Nick Mathewson2025-07-101-1/+1
| |
| * netdir: new parameters from prop360.Nick Mathewson2025-07-101-0/+10
| | | | | | | | (maxima are as amended in torspec!411)
* | Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-092-2/+2
|/ | | | Made with https://crates.io/crates/typos-cli
* Temporarily suppress mismatched_lifetime_syntaxes.Gabriela Moldovan2025-07-071-0/+1
| | | | See #2060.
* NetParameters::saturating_update: log when a value is out of rangeJim Newsome2025-06-231-1/+71
| | | | | | | On one hand, this can be quite noisy when something *is* out of range. On the other hand, a clamped value shouldn't normally happen, and is likely to result in surprising and otherwise difficult-to-debug behavior.
* Log unrecognized net paramsJim Newsome2025-06-231-1/+4
|
* Merge branch 'hs-interval-min' into 'main'Nick Mathewson2025-06-101-1/+1
|\ | | | | | | | | tor-netdir: decrease minimum hsdir_interval from 30 to 5 See merge request tpo/core/arti!3042
| * tor-netdir: decrease minimum hsdir_interval from 30 to 5Jim Newsome2025-06-101-1/+1
| | | | | | | | | | | | | | | | This matches the spec change: <https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/406> Progress on: <https://gitlab.torproject.org/tpo/core/chutney/-/issues/40038>
* | proto: Move NegotiatedHopSettings to a higher levelNick Mathewson2025-06-101-0/+10
|/ | | | | | We will construct this object based on the circuit parameters _and_ on the target's supported protocol versions, so we need to do so when we have both pieces of info.
* NetDir::pick_n_relays: avoid some unwarranted warningsJim Newsome2025-06-051-3/+4
| | | | | | | | | | | | | | | | Previously we logged a warning whenever `choose_multiple_weighted` returns `Ok(iter)`, whenever `iter` contains fewer relays than requested. However, this is expected behavior of `choose_multiple_weighted` if the filtered list of relays doesn't have the requested number of relays, in which case it should return all of the relays in the filtered list. In particular, this condition occurs regularly in test networks when looking for candidate relays to add to the potential guard set while excluding those already in the potential guard set. We still warn if the returned list is fewer than requested, *and* fewer than available in the filtered list.
* netdir, relay-selection: require Fast and Stable for rendpoints.Nick Mathewson2025-05-201-1/+3
| | | | | | Since we don't know what kind of traffic we'll use a rendezvous point for, we don't want to use it if it isn't "Fast" (reasonably high bw) and "Stable" (unlikely to crash soon).
* hs: Prevent a client from using a `MiddleOnly` relay for onion servicesNeel Chauhan2025-05-202-6/+10
| | | | | | > The actual impact of this patch is to prevent usage of MiddleOnly > relays as Introduction Points. The Rendezvous Point logic isn't > hooked up yet - nick
* netdir: fix warning about an opportunity to use saturating_subNick Mathewson2025-05-151-5/+1
|
* tor-netdir: Warn on one more case of insufficient itemsNick Mathewson2025-04-291-1/+12
| | | | | | Now that choose_multiple_weighted can once more return fewer items than requested, we should warn when it does so, to be consistent with our other cases of warning about #1907.
* tor-netdir: test for rand 0.9.1 behavior instead of 0.9.0Nick Mathewson2025-04-291-3/+9
| | | | | | | | Rand 0.9.1 reverted the changes that caused #1903, in https://github.com/rust-random/rand/pull/1623. This broke our test that made sure that rand wasn't going to change their behavior _again_ :)
* Merge branch 'todos-msrv' into 'main'Jim Newsome2025-04-241-3/+0
|\ | | | | | | | | various crates: MSRV TODO standardization and cleanup of an old TODO See merge request tpo/core/arti!2945
| * tor-netdir: remove lint allow as per TODOhashcatHitman2025-04-161-3/+0
| | | | | | | | | | - https://github.com/rust-lang/rust-clippy/issues/11764 was fixed upstream, so this is no longer needed.
* | Rename recommended_protocols to protocol_statuses.Nick Mathewson2025-04-162-4/+4
| | | | | | | | | | This name reflects its purpose better than the original one, since it includes required protocols as well as recommended ones.
* | netdir: Add a recommended_protocols() to NetDirProviderNick Mathewson2025-04-162-0/+19
| |
* | dirmgr, netdir: Store protocol requirments as soon as they are validated.Nick Mathewson2025-04-161-0/+4
| |
* | Fix another miscapitalized "MicroDesc"Nick Mathewson2025-04-161-1/+1
|/
* netdir: Add a (hopefully) temporary workaroundNick Mathewson2025-03-251-3/+27
| | | | | Instead of doing the more sensible thing when every relay has weight 0, give a warning message.
* netdir: Add a note about using f64Nick Mathewson2025-03-251-0/+8
|
* netdir: Another test for choose_multiple_weighted.Nick Mathewson2025-03-251-0/+17
| | | | | | Here we test the (arguably inconsistent behavior) where can we return fewer items than requested if no item had zero weight. (If this ever becomes an error, we need to modify the calling code.)
* netdir: Warn on unexpected WeightedErrorsNick Mathewson2025-03-251-5/+13
| | | | | | WeightedError::InsufficientNonzero is expected under some circumstances, but the other instances would mean that we have a bug.
* netdir: add a test to verify weighted samplingNick Mathewson2025-03-251-3/+37
| | | | | We want to make sure that behavior for 0-weighted elements is consistent for choose_multiple_weighted and choose_weighted.