Commit Graph

522 Commits

Author SHA1 Message Date
Ian Jackson 42df88d6bf Run maint/add_warning to add lint block everywhere 2023-08-23 10:34:00 +01:00
Nick Mathewson cec6d0ce33 Run add_warnings on all files. 2023-08-04 07:45:04 -04:00
Nick Mathewson 1e96d1b95a Remove semver.md files now that 1.1.7 is out. 2023-08-01 12:55:52 -04:00
Nick Mathewson 3acdf102c7 Increment patchlevel versions of crates with minor changes
These crates are at version 0.x.y, so we don't need to distinguish
new-feature changes from other changes:

```
tor-basic-utils
fs-mistrust
tor-error
tor-geoip
tor-checkable
tor-linkspec
tor-netdoc
tor-netdir
tor-persist
tor-ptmgr
tor-hsservice
```

This crate has a breaking change, but only when the semver-breaking
feature `experimental-api` is enabled:

```
tor-config
```

This crate is at version 1.x.y, but has no new public APIs, and
therefore does not need a minor version bump:

```
arti
```
2023-08-01 10:57:55 -04:00
Nick Mathewson 6f2ae59603 Update minor versions on crates that have had breaking changes
These crates had first-order breaking changes:

```
retry-error
tor-keymgr
tor-proto
tor-hsclient
tor-rtmock
```

Additionally, these broke because they re-exposed RetryError:

```
tor-circmgr
```

Additionally, these broke because they may re-expose something from
tor-proto:

```
    arti-client
    tor-chanmgr
    tor-dirclient
    tor-dirmgr
    tor-guardmgr
```

Additionally, these broke for other fiddly reasons:

`tor-ptmgr` implements traits from tor-chanmgr, which has a breaking
change above.

`arti-hyper` exposes types from arti-client in its API.
2023-08-01 10:51:25 -04:00
Ian Jackson dd5ceed791 tor-circmgr: impl AsRef<dyn std::error::Error> for some error types
We're about to want this.
2023-07-18 13:10:03 +01:00
Ian Jackson 3acc2af4f3 Merge branch 'clippy-allow' into 'main'
clippy: Allow some of our existing code patterns

See merge request tpo/core/arti!1396
2023-07-11 09:37:42 +00:00
Ian Jackson b151237a7f rng ranges: Use gen_range_infallible() for Duration::ZERO..=T 2023-07-10 16:08:03 +01:00
Ian Jackson 8ae759ef95 rng ranges: Use gen_range_checked().unwrap() in test case
Ideally we would be allowed to use vanilla gen_range() here, but there
doesn't seem to be a way to allow a specific clippy-forbidden method
using #[allow] and we probably don't want to make a blanket allow.
2023-07-10 16:07:18 +01:00
Ian Jackson 332285015f rng ranges: Use gen_range_checked().expect() in obvious cases (fmt) 2023-07-10 16:07:18 +01:00
Ian Jackson 5e10805ede rng ranges: Use gen_range_checked().expect() in obvious cases
In each of these, it is locally obvious that the range is nonempty.
2023-07-10 16:07:18 +01:00
Ian Jackson 473447a82e Run maint/add_warning to actually apply new lint allows 2023-07-10 13:49:51 +01:00
Nick Mathewson 7d1c8dfde0 Merge branch 'inclusive' into 'main'
rng ranges: Use inclusive Duration ranges in several places

See merge request tpo/core/arti!1385
2023-07-07 17:07:58 +00:00
Ian Jackson bcc3e6fef8 rng ranges: Use inclusive Duration ranges in several places
Many of these call sites would panic if, somehow, the upper bound was
zero.  In most cases it is very complicated to see if whether this
could happen.

However, there is a better answer:

Durations are (conceptually) dense, so picking the closed set (which
includes its boundary) rather than the open one (which doesn't) will
make little practical difference.

So change four call sites to use `..=` instead of just `..`.
2023-07-07 16:13:52 +01:00
Nick Mathewson 70f0fe634f Merge branch 'report-bugs-v2' into 'main'
Optional tracing support in tor-error for error reporting

See merge request tpo/core/arti!1379
2023-07-07 13:49:59 +00:00
Nick Mathewson a441b4e9d3 circmgr: Use event_report!() and similar macros
This simplifies our logging a little, and implements part of
2023-07-07 09:00:31 -04:00
Ian Jackson 80f397fb0b Merge branch 'allow_missing_panics' into 'main'
add_warning: Tolerate clippy::missing_panics_doc

Closes #950

See merge request tpo/core/arti!1380
2023-07-07 12:53:46 +00:00
Nick Mathewson 03f9f9987a Run add_warning to remove `missing_panics_doc` deny.
Closes #950.
2023-07-06 14:32:23 -04:00
Nick Mathewson 07b4b11d7a Avoid matches!(x, None), matches!(x, Ok(_))
This appeases clippy-nightly.
2023-07-06 14:26:48 -04:00
Nick Mathewson 27bd990a79 Remove semver.md files for 1.1.6 2023-06-30 10:28:53 -04:00
Nick Mathewson de13a7319b Bump patchlevel versions on crates with smaller changes
Done with the commands below.

The following crates have had various changes, and should get a
patchlevel bump. Since they are pre-1.0, we do not need to
distinguish new APIs from other changes.

```
cargo set-version --bump patch -p arti-client
cargo set-version --bump patch -p safelog
cargo set-version --bump patch -p tor-bytes
cargo set-version --bump patch -p tor-cert
cargo set-version --bump patch -p tor-circmgr
cargo set-version --bump patch -p tor-config
cargo set-version --bump patch -p tor-consdiff
cargo set-version --bump patch -p tor-dirclient
cargo set-version --bump patch -p tor-dirmgr
cargo set-version --bump patch -p tor-error
cargo set-version --bump patch -p tor-hsservice
cargo set-version --bump patch -p tor-linkspec
cargo set-version --bump patch -p tor-llcrypto
cargo set-version --bump patch -p tor-netdir
cargo set-version --bump patch -p tor-netdoc
cargo set-version --bump patch -p tor-proto
cargo set-version --bump patch -p tor-rpcbase
cargo set-version --bump patch -p tor-socksproto
```

This crate has new features, but no new non-experimental Rust APIs.
So even though it is post-1.0, it gets a patchlevel bump.

```
cargo set-version --bump patch -p arti
```
2023-06-30 08:42:21 -04:00
Nick Mathewson 65e81bf0ca Bump minor versions on crates with breaking changes
Done with:
```
cargo set-version --bump minor -p tor-hsclient
cargo set-version --bump minor -p arti-rpcserver
cargo set-version --bump minor -p tor-hscrypto
cargo set-version --bump minor -p tor-cell
```
2023-06-30 08:38:16 -04:00
Nick Mathewson 90b5ce7fd7 Merge branch 'stabilize-hs-client' into 'main'
Mark all {hs,onion-serivce}-client features as non-experimental.

Closes #896

See merge request tpo/core/arti!1347
2023-06-29 18:50:30 +00:00
Nick Mathewson d164a9dac2 Mark all {hs,onion-serivce}-client features as non-experimental. 2023-06-29 13:09:37 -04:00
Ian Jackson a7d1efe2ce tor-circmgr: Provide estimate_timeout as a method on HsCircPool 2023-06-29 17:41:49 +01:00
Ian Jackson 799480d885 Merge branch 'circparams' into 'main'
tor-hsclient: Use proper CircParameters

Closes #935

See merge request tpo/core/arti!1340
2023-06-29 15:03:40 +00:00
Ian Jackson f73c06314c tor-circmgr: Expose CircParameters from NetParameters construction
As per #935.

I called this "circparameters_from_netparameters" not
"circparameters_from_netparams" because the type is "NetParameters"
not "NetParams".
2023-06-29 14:24:19 +01:00
Nick Mathewson 02878518b8 circmgr: Refactor duplicate logic.
These two functions are only slightly different, and benefit from
taking a Fn.
2023-06-28 15:28:52 -04:00
Nick Mathewson 6affb50c1a circmgr: Remove a "TODO HS" about path restrictions.
I looked through the C tor source code and couldn't find any
additional path restrictions.
2023-06-28 15:28:52 -04:00
Nick Mathewson d32ba9ed18 circmgr: Defer two "TODO HS" in hspool
One of these is test-related; one is vanguards-related.
2023-06-28 15:28:52 -04:00
Ian Jackson cdad2db082 HS configuration: Add retry parameters to configuration
I think these should go in `[circuit_timing]`.  That section already
has some retry parameters, so is not strictly *timing*.

This is not honoured yet.
2023-06-28 13:32:54 +01:00
Nick Mathewson 0bffdf23a4 Upgrade to itertools 0.11.0
The breaking changes here do not seem to affect us.
2023-06-26 09:30:54 -04:00
Jim Newsome 7a8bade262 random_idx_where: Ensure uniform distribution of choice
Previously, this was more likely to select elements that occurred after
other elements that didn't satisfy the predicate.
2023-06-23 08:25:01 -05:00
Jim Newsome 35e6cc285b Add more tests for random_idx_where 2023-06-23 08:24:35 -05:00
Ian Jackson 03960b5048 Merge branch 'idx' into 'main'
tor-circmgr: Fix random_idx_where with empty slice

Closes #918

See merge request tpo/core/arti!1296
2023-06-23 13:12:22 +00:00
Ian Jackson 879c540cfa tor-circmgr: Test random_idx_where with empty slice
I have verified that this test fails, as expected, when applied
without the corresponding bugfix.
2023-06-23 11:09:59 +01:00
Ian Jackson a0f5dbc05d tor-circmgr: random_idx_where: Don't panic on empty range
Fixes #918.
2023-06-23 11:09:55 +01:00
Nick Mathewson 24545fd455 Merge branch 'circmgr-timeout-est' into 'main'
circmgr: New API to expose estimate-based timeouts.

See merge request tpo/core/arti!1281
2023-06-22 18:50:40 +00:00
Nick Mathewson dcb3b06a95 circmgr: Now that Action is public, clean it up a little. 2023-06-22 13:53:14 -04:00
Nick Mathewson 2b0d04a5fe circmgr: New API to expose estimate-based timeouts.
This will help create good timeout values for various onion-service
operations.
2023-06-22 13:53:14 -04:00
Nick Mathewson 5ce7221f06 hspool: Use let-else pattern; our MSRV permits it. 2023-06-22 13:21:36 -04:00
Nick Mathewson 1bb298d1e6 circmgr: Use path_ref() instead of path(). 2023-06-22 09:45:47 -04:00
Ian Jackson 161b9844da lints: Run maint/add_warning to actually apply new lints 2023-06-21 12:15:41 +01:00
gabi-250 602bcc3c47 Typo fixes 2023-06-20 11:47:02 +00:00
Nick Mathewson 1691c35392 circmgr: Use a slightly nicer way to pick a circuit from our pool.
This algorithm only looks at circuits until it finds one that
satisfies our needs.  To get a random circuit, it just randomizes
the starting point within the pool.

This optimization may help if we let circuit pools grow large.
2023-06-16 12:14:49 -04:00
Nick Mathewson 686d5cf209 circmgr: Make hspool size dynamic
Previously we'd always try to keep 8 circuits ready.  That doesn't
make sense if we are super-busy.  Instead, if we run out of
circuits, we double the amount that we try to keep ready, and if we
never go under 80% of our target number, we half the number we try
to keep ready.

We limit the rate of change here, to make sure that we aren't
flapping too much or shrinking too aggressively.

This algorithm is still a mite arbitrary, and will need tuning in
the future.
2023-06-16 12:11:49 -04:00
Nick Mathewson 69179c5dfe circmgr::hspool: Move the Mutex into an intermediary Inner struct
This will be helpful as we complexify the pool behavior a bit.
2023-06-16 11:42:38 -04:00
Nick Mathewson 1c470fd483 circmgr: Remove TODOS about retrying.
These functions' documentation already says that they don't retry,
and hsclient appears to be where we are concentrating our retry
efforts.
2023-06-16 11:40:00 -04:00
Nick Mathewson 672062113e cirmgr: remove a dead-code exception. 2023-06-16 08:45:49 -04:00
Nick Mathewson ac90cb7500 Upgrade async-trait requirement to 1.54
We need the fix from [82d69902], which first appeared in async-trait
version 1.54.  (Technically we only need this fix in tor-hsclient,
but we may as well update our minimal async-trait version everywhere.)

[82d69902]: 82d6990253
2023-06-12 13:15:59 -04:00