summaryrefslogtreecommitdiff
path: root/crates/tor-netdir/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* guardmgr, netdir: fix some needless-mut warningsNick Mathewson2023-05-181-2/+2
| | | | Found by clippy nightly
* netdir: New function to check consistency of a HasRelayIdsNick Mathewson2023-05-161-0/+142
| | | | | | | | | | | This function will be used to look up a relay by a set of LinkSpecs given from an incoming HsDesc or INTRODUCE2 message. It differs from other "lookup relay by IDs" functions in that it needs to be able to return "here's a relay", "couldn't found a relay", or "learned that this relay is impossible." Closes #855: This is the only new API needed for ChanTarget validation, I think.
* tor-netdir: Shuffle the list of HS dirs used for downloading descriptors.Gabriela Moldovan2023-05-041-10/+22
| | | | | | | | We'll probably need the hsdir list to be shuffled deterministically for testing purposes (this might be desirable, for example, when we write a test for HS descriptor download retries). Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-netdir: Update tests to parse the descriptor, make test consensus ↵Gabriela Moldovan2023-05-031-8/+11
| | | | | | lifetime configurable. Signed-off-by: Gabriela Moldovan <[email protected]>
* Use bool::then_some() as appropriateNick Mathewson2023-04-111-1/+1
| | | | | | Now that we require a version of Rust that allows `b.then_some(v)`, clippy complains about our use of `b.then(|| v)`.
* Merge branch 'hs' into 'main'Ian Jackson2023-04-111-5/+19
|\ | | | | | | | | Download HS descriptors See merge request tpo/core/arti!1118
| * hs dirs: Note a thing we don't implement yetIan Jackson2023-04-111-0/+11
| | | | | | | | We'll add this later, about here.
| * hs dirs: Implement spread_fetchIan Jackson2023-04-111-1/+2
| |
| * hs dirs: Fix wrong ignored variable nameIan Jackson2023-04-111-1/+1
| | | | | | | | This is the HsDirIndex, not the Hs[Blind]Id.
| * hs dirs: Replicas are 1-indexedIan Jackson2023-04-111-2/+2
| |
| * tor-netdir: Make an import more preciseIan Jackson2023-04-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | With this cargo +stable clippy --locked --offline -p tor-netdir --features=hs-client --all-targets I got this: 64 | use {hsdir_params::HsDirParams, hsdir_ring::HsDirRing, itertools::chain, std::iter}; | ^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
* | tor-netdir: Fix capitalisation of a doc linkIan Jackson2023-04-111-1/+1
| | | | | | | | Fixes a rustdoc warning.
* | tor-netdir: Fix link to hs_time_period functionIan Jackson2023-04-111-1/+1
|/ | | | Fixes a rustdoc warning.
* tor-netdir: iter_filter_secondary: Make it less of a messIan Jackson2023-03-301-13/+10
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1094#note_2891857
* tor-netdir: Expand on comment for HsRingRings::itergabi-2502023-03-301-1/+1
|
* tor-netdir: Minor docs fixesgabi-2502023-03-301-2/+3
|
* tor-netdir: Implement hs_dirs accessorIan Jackson2023-03-301-2/+16
|
* tor-netdir: hs_dirs accessor: change semantics, type, and nameIan Jackson2023-03-301-7/+9
| | | | | Don't have it take the TP, so that the caller must call it multiple times. Instead, have it return all the relevant relays.
* tor-netdir: Provide hs_all_time_periods instead of ..._secondary_...Ian Jackson2023-03-301-5/+8
| | | | | | | | I don't think the server-side support will want to explicitly call current and then secondary. Rather, it will want to iterate over all the relevant ones. And fix the name, and add another comment about whether we need this.
* tor-netdir: Rename hs_time_periodIan Jackson2023-03-301-3/+5
| | | | | | | | Change its name to hs_* like we do with things at this layer. But, it turns out, that at least for hs client connections to fetch the descriptor, I don't seem to need to call it yet ? Maybe it's not needed.
* tor-netdir: Sort out HsDirOpIan Jackson2023-03-301-2/+3
| | | | | * Change its name to Hs* like we do with things at this layer * Make the Upload variant cfg-conditional
* tor-netdir: Reorganise iteration over hsdir ringsIan Jackson2023-03-301-4/+24
| | | | | Provide iter_for_op, by changing iter into iter_filter_secondary and having a new entrypoint iter.
* tor-netdir: Provide relay_by_rs_idxIan Jackson2023-03-301-0/+16
|
* tor-netdir: Use `pos` not `idx` in test network constructorsIan Jackson2023-03-271-14/+14
| | | | | | | | | There are too many things called "index" here. `idx` could be read to mean the table index `RouterStatusIdx`, the hsdir hash `HsDirIndex`, or an entry in some other one of these tables. Here's, it's just the sequence number of the index in the test netdir. Use `pos` for that. (`seq` would have been another possibility.)
* tor-netdir: eliminate ref to abolished MdEntryIan Jackson2023-03-271-2/+2
| | | | | This was removed in c3e74973b4201f71275d8cf4c0c954cfb8d0eba5 netdir: Use an even smaller rep for list of microdescs
* tor-netdir: Use `rsidx` consistent for `RouterStatusIdx`Ian Jackson2023-03-271-36/+36
| | | | | | | | | This is an `IndexVec` key type. Some places used `idx`, some `rsi`, some `rs_idx`. Use `rsidx` for it everywhere, including in locals, function names, and fields. `rsidx` is a compromise. `rsi` might be a bit opaque, but we want a one-"word" name since it appears inside other names.
* Rename onion-* cargo features to hs-* in tor-* cratesIan Jackson2023-02-281-24/+24
| | | | Fixes #756
* Fix minimal-versions (.then_some is too new)Ian Jackson2023-02-091-1/+1
|
* tor-netdir: Make is_hsdir_for_ring crate-localIan Jackson2023-02-091-1/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012#note_2876824
* Fix typosNick Mathewson2023-02-091-2/+2
|
* Fix compilation with various feature combinationsIan Jackson2023-02-091-5/+18
|
* hsdir: rustfmtIan Jackson2023-02-091-6/+5
| | | | | Deferred formatting changes which would have obscured the commits they were prompted by.
* hsdir: Actually compute the hash ringIan Jackson2023-02-091-4/+0
|
* hsdir: Be able to enumerate the hidden service directoriesIan Jackson2023-02-091-0/+25
| | | | | | * Provide an accessor for the HSDIR flag * Provide a function for testing a relay for hsdir inclusion * Provide an iterator on NetDir that returns the hsdirs
* hsdir: Ring calculation plumbingIan Jackson2023-02-091-16/+10
| | | | | | | | | | | * Implement Netdir::compute_rings in terms of a new HsDirRing::compute, that currently does nothing. * Actually call Netdir::compute_rings (since now it doesn't panic). * Make Netdir::compute_rings not be pub. We do this unconditionally, rather than exposing the distinction between a netdir-without-hsdir and a netdir-with-hsdir.
* hsdir representation: Introduce HsDirs generic typeIan Jackson2023-02-091-33/+56
| | | | | This already allows us to get rid of some duplication, and will be useful more widely in a moment.
* hsdir: Rename HsRingParams to HsDirParamsIan Jackson2023-02-091-2/+2
| | | | | | | | | The file which contains this type is called hsdir_params.rs. We have a general problem with slight confusion about when to includen "dir" and when to include "ring". Resolve this in favour of the rule now added to the module-level doc comment.
* hsdir_params: Rename some variables for consistencyIan Jackson2023-02-091-2/+2
| | | | | | | | | | These variables are going to be struct fields, which will sort of enforce consistent naming. The struct fields are going to appear in a moment. We'll call the fields "current" and "secondary" after the naming in the test cases. And import hsdir_params::HsRingParams, which we're going to make more references to.
* hsdir: Replace open-coded params fields and args with HsRingParamsIan Jackson2023-02-091-2/+2
| | | | | | This will enable us to pass these around more conveniently. And make empty_from_params take an owned params, which it would like.
* hsdir: Remove a done TODO - this *is* now a TiSliceIan Jackson2023-02-091-1/+0
|
* tor-netdir: Provide Netdir::md_by_idxIan Jackson2023-02-091-0/+6
| | | | We'll need this shortly.
* tor-netdir: Store previous netdir (if required by features)Ian Jackson2023-02-091-1/+15
|
* tor-netdoc: Change fill_from_previous_netdirIan Jackson2023-02-091-10/+7
| | | | | | | | | | | | | | | | * Remove the return value, which was not used anywhere. Also remove the code to calculate the return value. * Take an Arc<NetDir> rather than a reference. We are going to want this for HS support. This has no overall effect on the lifetime of the4 Arc, which was owned at the one call site and then imediately dropped. * Change the documentation to explain what the function's role is in the netdir API, rather than the fiddly details of what it actually does internally. Relegate the latter to a code comment. (When we have HS, this will do more, or, at least, make further arrangements.)
* tor-hscrypto: Rename key types to correspond to new spec names.Nick Mathewson2023-02-081-2/+2
|
* Tidy up docs about RouterStatusIdxIan Jackson2023-02-011-9/+6
| | | | | | Always use "index" and not "position". Remove wording which is otiose given the type name.
* tor-netdir: Use typed-index-collections for router status indexIan Jackson2023-02-011-16/+29
|
* tor-netdir: Provide ConsensusRelays extension trait (fmt)Ian Jackson2023-02-011-4/+1
|
* tor-netdir: Provide ConsensusRelays extension traitIan Jackson2023-02-011-11/+31
| | | | | Call it everywhere instead of the inherent method on MdConsensus. (Verified by ad-hoc temporarily renaming MdConsensus::relays().)
* Change two in-code references to the wrong feature nameIan Jackson2023-02-011-2/+2
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/756 I think this is going in the wrong direction, but it is better to fix it so that the names agree for now, pending a decision on the naming.
* Turn compute_ring_params into a method.Nick Mathewson2023-01-281-1/+1
|