Commit Graph

250 Commits

Author SHA1 Message Date
Nick Mathewson e26445b1b0 Use bool::then_some() as appropriate
Now that we require a version of Rust that allows
`b.then_some(v)`, clippy complains about our use of
`b.then(|| v)`.
2023-04-11 15:32:32 -04:00
Nick Mathewson 104d64589d Increment MSRV to 1.65 in every crate. 2023-04-11 15:31:12 -04:00
Ian Jackson b8b02b38f1 Merge branch 'hs' into 'main'
Download HS descriptors

See merge request tpo/core/arti!1118
2023-04-11 19:19:48 +00:00
Ian Jackson 23c56db111 tor-netdir: Fix capitalisation of a doc link
Fixes a rustdoc warning.
2023-04-11 19:31:10 +01:00
Ian Jackson df3e8242ea tor-netdir: Fix link to hs_time_period function
Fixes a rustdoc warning.
2023-04-11 19:31:10 +01:00
Ian Jackson 565b063a52 hs dirs: Note a thing we don't implement yet
We'll add this later, about here.
2023-04-11 19:14:01 +01:00
Ian Jackson d8ed32b321 hs dirs: Implement spread_fetch (fmt) 2023-04-11 19:14:01 +01:00
Ian Jackson 95125d9e72 hs dirs: Implement spread_fetch 2023-04-11 19:14:01 +01:00
Ian Jackson 3ea8f3b7e0 hs dirs: Fix wrong ignored variable name
This is the HsDirIndex, not the Hs[Blind]Id.
2023-04-11 19:14:01 +01:00
Ian Jackson a3945ad3c6 hs dirs: Replicas are 1-indexed 2023-04-11 19:14:01 +01:00
Ian Jackson a1241bca43 tor-netdir: Make an import more precise
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
2023-04-11 19:14:01 +01:00
Ian Jackson dfceb50f69 tor-netdir: testnet: Make all non-guard non-exits be hsdirs 2023-04-05 15:10:07 +01:00
Nick Mathewson 289007ef96 Merge branch 'debug-hex' into 'main'
Debug two types as compact hex strings

See merge request tpo/core/arti!1104
2023-04-03 12:31:27 +00:00
Ian Jackson aafdf755c0 Debug as hex strings for HsBlindId and HsDirIndex 2023-03-31 19:10:17 +01:00
Ian Jackson 8a045af479 Merge branch 'netdir' into 'main'
tor-netdir: API changes to support hsconn hsdir fetch

See merge request tpo/core/arti!1094
2023-03-31 17:12:42 +00:00
Nick Mathewson 9ef115a7fb Patchlevel bumps for crates whose dependencies just changed.
These crates had no changes until just a moment ago. But since
we updated the versions on some of their dependents, they have now
changed themselves.  Thus they get patchlevel bumps.

```
tor-rtmock
tor-protover
tor-socksproto
tor-consdiff
tor-chanmgr
tor-dirclient
tor-hsservice
```
2023-03-31 08:30:14 -04:00
Nick Mathewson e208fb15ad Bump crate versions that have breaking changes
These crates have had breaking changes.  They are pre-1.0, so they get
a minor bump.

```
tor-basic-utils
tor-config
```
2023-03-31 08:28:06 -04:00
Nick Mathewson a81ab391ae Bump patchlevel on crates with non-breaking changes
For these crates, the changes are nontrivial, so we
_do_ bump the versions on which their dependent crates depend.

Fortunately, since they are all pre-1.0, we don't need to
distinguish semver-additions from other changes.  (Except for arti,
which _is_ post-1.0, but gets a patchlevel bump anyway.)

These are unstable crates with breaking changes:

```
tor-hscrypto
tor-hsclient
```

These have new or extended APIs:

```
safelog
tor-bytes
tor-cell
tor-linkspec
tor-llcrypto
tor-proto
tor-cert
arti-client
```

These have new unstable APIs or features:
```
tor-netdoc
tor-circmgr (also broke some unstable APIs)
arti (is post-1.0)
```

These have bugfixes only:
```
caret
tor-dirmgr
```
2023-03-31 08:24:39 -04:00
Nick Mathewson 622c79aaa6 Bump patchlevel on crates with semver-irrelevant changes.
Their dependents are _not_ updated to a more recent version.

These bumped the version of a dependency that they don't expose
```
tor-rtcompat
fs-mistrust
```

This one had internal refactoring:
```
tor-netdir
```

These had trivial changes only:
```
tor-checkable
tor-ptmgr
tor-guardmgr
arti-hyper
arti-bench
arti-testing
```
2023-03-31 08:20:58 -04:00
Ian Jackson 2eed641fb6 tor-netdir: iter_filter_secondary: Make it less of a mess
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1094#note_2891857
2023-03-30 17:02:47 +01:00
gabi-250 c7f924ff35 tor-netdir: Expand on comment for HsRingRings::iter 2023-03-30 16:02:27 +00:00
gabi-250 e7e305f9cd tor-netdir: Minor docs fixes 2023-03-30 15:37:07 +00:00
Ian Jackson 577940853f tor-netdir: Implmeent HsDirRing::find_pos 2023-03-30 15:53:51 +01:00
Ian Jackson 9b831933ef tor-netdir: Provide accessor for params field of HsDirParams 2023-03-30 15:47:06 +01:00
Ian Jackson 544d0e6d18 tor-netdir: Implement hs_dirs accessor 2023-03-30 15:47:06 +01:00
Ian Jackson 3c39c2f544 tor-netdir: hs_dirs accessor: change semantics, type, and name
Don't have it take the TP, so that the caller must call it multiple
times.  Instead, have it return all the relevant relays.
2023-03-30 15:47:06 +01:00
Ian Jackson e15f3c5348 tor-netdir: Provide hs_all_time_periods instead of ..._secondary_...
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.
2023-03-30 15:47:06 +01:00
Ian Jackson 4cf3cd00ef tor-netdir: Rename hs_time_period
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.
2023-03-30 15:47:06 +01:00
Ian Jackson db028a6d34 tor-netdir: Sort out HsDirOp
* Change its name to Hs* like we do with things at this layer
* Make the Upload variant cfg-conditional
2023-03-30 15:47:06 +01:00
Ian Jackson 4d3d79a511 tor-netdir: Reorganise iteration over hsdir rings
Provide iter_for_op, by changing iter into iter_filter_secondary and
having a new entrypoint iter.
2023-03-30 15:47:06 +01:00
Ian Jackson 7924e995f1 tor-netdir: Provide relay_by_rs_idx 2023-03-30 15:47:06 +01:00
Ian Jackson db968033cf tor-netdir: Make the hsdir ring be a TiVec
This eliminates an untyped `usize` index.
2023-03-30 15:43:48 +01:00
Ian Jackson 9940bd1eb4 tor-netdir: Use `pos` not `idx` in test network constructors
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.)
2023-03-27 17:32:16 +01:00
Ian Jackson 4da12a26a9 tor-netdir: Use `hsdir_index` for hidden service directory hashval (fmt) 2023-03-27 17:32:16 +01:00
Ian Jackson 325526a903 tor-netdir: Use `hsdir_index` for hidden service directory hashval
The hidden services directory hashring is a ring of hsdir relays,
sorted by a hash that the spec calls the "index".  That's `HsDirIndex`.

This was a bad idea because the word "index" is seriously overused,
but in Arti we must use the same terminology.

At least, qualify it everywhere.  Now one of these hsdir sort position
hashes is always, in our code, an `hsdir_index`.

I think this is necessary even inside modules called `hsdir_*`,
because those can deal with other kind of "index" too.
2023-03-27 17:31:23 +01:00
Ian Jackson a746e17c8e tor-netdir: eliminate ref to abolished MdEntry
This was removed in c3e74973b4
  netdir: Use an even smaller rep for list of microdescs
2023-03-27 17:26:51 +01:00
Ian Jackson 99ffb89b48 tor-netdir: Use `rsidx` consistent for `RouterStatusIdx`
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.
2023-03-27 17:25:52 +01:00
Nick Mathewson d6bb8fee0b Upgrade to bitflags 2.0
This version of bitflags now requires us to explicitly list the
traits that we want to derive for our bit-flags structs.
2023-03-13 08:47:14 -04:00
Nick Mathewson 886faa96b3 Remove semver.md files now that 1.1.2 is out. 2023-02-28 10:06:41 -05:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 3e1ae65212 Bump tor-units version for breaking change.
(The breaking change was removing `as_days()` from IntegerMinutes.)

We are _not_ calling this a downstream-api breaking change, per
discussion at
https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012?commit_id=bb2ab7c2a3e0994bb438188511688b5b039cae29#note_2876819
2023-02-28 07:10:00 -05:00
Nick Mathewson 4479d52a88 Bump patch-versions for breaking changes in tor-hs{crypto,client}
These are API breaks, but the crates themselves are currently
100% experimental, so there's no need to bump the minor versions
according to our semver rules.
2023-02-28 07:06:15 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Ian Jackson f63c7c48af Rename onion-* cargo features to hs-* in tor-* crates
Fixes #756
2023-02-28 11:10:17 +00:00
Ian Jackson 3d6e6fcf0d Fix minimal-versions (.then_some is too new) 2023-02-09 16:07:16 +00:00
Ian Jackson 4b7f2e84bf tor-netdir: Make is_hsdir_for_ring crate-local
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1012#note_2876824
2023-02-09 16:07:16 +00:00
Ian Jackson 4ca661a4dc tor-netdir: Document fill_from_previous_netdir semver 2023-02-09 14:57:29 +00:00
Nick Mathewson 8cda5a1a3e Clarify which netdir index is meant 2023-02-09 14:56:30 +00:00
Nick Mathewson 33b8ebd67e Fix typos 2023-02-09 14:48:56 +00:00
Ian Jackson 1f3f659536 Fix compilation with various feature combinations 2023-02-09 14:35:57 +00:00