aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr
Commit message (Collapse)AuthorAgeFilesLines
* arti-client: add exit selection with GeoIP country codeseta2023-09-187-10/+180
| | | | | | | | | | | | | | | | | | | | This threads the country codes work through the rest of the codebase: - `tor-dirmgr` will now enable GeoIP with the embedded database when the `geoip` future is enabled - This can be extended later using the `DirMgrConfig` to allow specifying a custom database; this is not done here, though - `tor-circmgr`'s `SupportedCircUsage` and `TargetCircUsage` fields gain new `country_code` members to allow filtering circuits by country - These are `()` in builds where the `geoip` feature is not enabled -- doing it this way means we don't have to copy and paste huge swathes of code, since we can't use `#[cfg]` in patterns - `ExitPathBuilder` gains (hacked-in) support for choosing a relay with the correct country code - Due to the lack of conjuction, we just copy and paste a small bit, pending further refactoring - `StreamPrefs` now lets you specify a country code, letting embedders make use of the feature
* Bump patchlevel (not dependents) on crates with trivial changesNick Mathewson2023-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes: ``` tor-basic-utils caret fs-mistrust safelog retry-error tor-events tor-units tor-geoip tor-rtcompat tor-rpcbase tor-protover tor-socksproto tor-checkable tor-congestion tor-persist tor-circmgr arti-rpcserver arti-config arti-hyper arti-bench arti-testing tor-consdiff ```
* Update patchlevel for crates with nontrivial changes.Nick Mathewson2023-09-051-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are: ``` hashx equix tor-async-utils tor-error tor-config tor-rtmock tor-llcrypto tor-bytes tor-hscrypto tor-hspow tor-cert tor-linkspec tor-cell tor-proto tor-netdoc tor-netdir tor-chanmgr tor-guardmgr tor-dirmgr tor-keymgr tor-hsclient tor-hsservice arti-client arti ```
* Upgrade to visibility 0.1.0Nick Mathewson2023-09-051-1/+1
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-2312-0/+12
|
* Run add_warnings on all files.Nick Mathewson2023-08-041-2/+2
|
* Remove semver.md files now that 1.1.7 is out.Nick Mathewson2023-08-011-1/+0
|
* Increment patchlevel versions of crates with minor changesNick Mathewson2023-08-011-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Update minor versions on crates that have had breaking changesNick Mathewson2023-08-011-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tor-circmgr: impl AsRef<dyn std::error::Error> for some error typesIan Jackson2023-07-182-0/+4
| | | | We're about to want this.
* Merge branch 'clippy-allow' into 'main'Ian Jackson2023-07-1112-0/+13
|\ | | | | | | | | clippy: Allow some of our existing code patterns See merge request tpo/core/arti!1396
| * Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-1012-0/+13
| |
* | rng ranges: Use gen_range_infallible() for Duration::ZERO..=TIan Jackson2023-07-101-1/+1
| |
* | rng ranges: Use gen_range_checked().unwrap() in test caseIan Jackson2023-07-101-2/+2
| | | | | | | | | | | | 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.
* | rng ranges: Use gen_range_checked().expect() in obvious cases (fmt)Ian Jackson2023-07-101-1/+2
| |
* | rng ranges: Use gen_range_checked().expect() in obvious casesIan Jackson2023-07-102-3/+6
|/ | | | In each of these, it is locally obvious that the range is nonempty.
* Merge branch 'inclusive' into 'main'Nick Mathewson2023-07-071-1/+1
|\ | | | | | | | | rng ranges: Use inclusive Duration ranges in several places See merge request tpo/core/arti!1385
| * rng ranges: Use inclusive Duration ranges in several placesIan Jackson2023-07-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 `..`.
* | Merge branch 'report-bugs-v2' into 'main'Nick Mathewson2023-07-076-43/+30
|\ \ | |/ |/| | | | | Optional tracing support in tor-error for error reporting See merge request tpo/core/arti!1379
| * circmgr: Use event_report!() and similar macrosNick Mathewson2023-07-076-43/+30
| | | | | | | | This simplifies our logging a little, and implements part of
* | Merge branch 'allow_missing_panics' into 'main'Ian Jackson2023-07-071-1/+0
|\ \ | | | | | | | | | | | | | | | | | | add_warning: Tolerate clippy::missing_panics_doc Closes #950 See merge request tpo/core/arti!1380
| * | Run add_warning to remove `missing_panics_doc` deny.Nick Mathewson2023-07-061-1/+0
| |/ | | | | | | Closes #950.
* / Avoid matches!(x, None), matches!(x, Ok(_))Nick Mathewson2023-07-061-1/+1
|/ | | | This appeases clippy-nightly.
* Remove semver.md files for 1.1.6Nick Mathewson2023-06-301-1/+0
|
* Bump patchlevel versions on crates with smaller changesNick Mathewson2023-06-301-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Bump minor versions on crates with breaking changesNick Mathewson2023-06-301-1/+1
| | | | | | | | | | 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 ```
* Merge branch 'stabilize-hs-client' into 'main'Nick Mathewson2023-06-291-2/+3
|\ | | | | | | | | | | | | Mark all {hs,onion-serivce}-client features as non-experimental. Closes #896 See merge request tpo/core/arti!1347
| * Mark all {hs,onion-serivce}-client features as non-experimental.Nick Mathewson2023-06-291-2/+3
| |
* | tor-circmgr: Provide estimate_timeout as a method on HsCircPoolIan Jackson2023-06-291-1/+21
|/
* Merge branch 'circparams' into 'main'Ian Jackson2023-06-292-15/+18
|\ | | | | | | | | | | | | tor-hsclient: Use proper CircParameters Closes #935 See merge request tpo/core/arti!1340
| * tor-circmgr: Expose CircParameters from NetParameters constructionIan Jackson2023-06-292-15/+18
| | | | | | | | | | | | | | | | As per #935. I called this "circparameters_from_netparameters" not "circparameters_from_netparams" because the type is "NetParameters" not "NetParams".
* | circmgr: Refactor duplicate logic.Nick Mathewson2023-06-281-27/+21
| | | | | | | | | | These two functions are only slightly different, and benefit from taking a Fn.
* | circmgr: Remove a "TODO HS" about path restrictions.Nick Mathewson2023-06-281-3/+0
| | | | | | | | | | I looked through the C tor source code and couldn't find any additional path restrictions.
* | circmgr: Defer two "TODO HS" in hspoolNick Mathewson2023-06-281-2/+2
|/ | | | One of these is test-related; one is vanguards-related.
* HS configuration: Add retry parameters to configurationIan Jackson2023-06-282-0/+37
| | | | | | | 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.
* Upgrade to itertools 0.11.0Nick Mathewson2023-06-261-1/+1
| | | | The breaking changes here do not seem to affect us.
* random_idx_where: Ensure uniform distribution of choiceJim Newsome2023-06-231-22/+32
| | | | | Previously, this was more likely to select elements that occurred after other elements that didn't satisfy the predicate.
* Add more tests for random_idx_whereJim Newsome2023-06-231-0/+10
|
* Merge branch 'idx' into 'main'Ian Jackson2023-06-231-0/+10
|\ | | | | | | | | | | | | tor-circmgr: Fix random_idx_where with empty slice Closes #918 See merge request tpo/core/arti!1296
| * tor-circmgr: Test random_idx_where with empty sliceIan Jackson2023-06-231-0/+7
| | | | | | | | | | I have verified that this test fails, as expected, when applied without the corresponding bugfix.
| * tor-circmgr: random_idx_where: Don't panic on empty rangeIan Jackson2023-06-231-0/+3
| | | | | | | | Fixes #918.
* | Merge branch 'circmgr-timeout-est' into 'main'Nick Mathewson2023-06-224-7/+35
|\ \ | | | | | | | | | | | | circmgr: New API to expose estimate-based timeouts. See merge request tpo/core/arti!1281
| * | circmgr: Now that Action is public, clean it up a little.Nick Mathewson2023-06-221-3/+2
| | |
| * | circmgr: New API to expose estimate-based timeouts.Nick Mathewson2023-06-224-4/+33
| | | | | | | | | | | | | | | This will help create good timeout values for various onion-service operations.
* | | hspool: Use let-else pattern; our MSRV permits it.Nick Mathewson2023-06-221-6/+2
| | |
* | | circmgr: Use path_ref() instead of path().Nick Mathewson2023-06-221-24/+45
| |/ |/|
* | lints: Run maint/add_warning to actually apply new lintsIan Jackson2023-06-211-0/+2
|/
* Typo fixesgabi-2502023-06-201-2/+2
|
* circmgr: Use a slightly nicer way to pick a circuit from our pool.Nick Mathewson2023-06-161-13/+58
| | | | | | | | 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.
* circmgr: Make hspool size dynamicNick Mathewson2023-06-162-28/+108
| | | | | | | | | | | | | | 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.