summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* 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-281-0/+36
| | | | | | | 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.
* 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-223-7/+34
|\ \ | | | | | | | | | | | | 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-223-4/+32
| | | | | | | | | | | | | | | 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.
* circmgr::hspool: Move the Mutex into an intermediary Inner structNick Mathewson2023-06-162-35/+53
| | | | This will be helpful as we complexify the pool behavior a bit.
* circmgr: Remove TODOS about retrying.Nick Mathewson2023-06-161-5/+0
| | | | | | These functions' documentation already says that they don't retry, and hsclient appears to be where we are concentrating our retry efforts.
* cirmgr: remove a dead-code exception.Nick Mathewson2023-06-161-1/+0
|
* Merge branch 'info-to-warn' into 'main'gabi-2502023-05-171-5/+8
|\ | | | | | | | | | | | | Change log levels of messages from INFO to others Closes #854 See merge request tpo/core/arti!1172
| * Change log level to debug and warn for certain appropriate situationsSaksham Mittal2023-05-171-5/+8
| | | | | | | | | | | | This commit changes certain log messages to debug for recoverable errors and a warn if all such attempts fail, in order to not clutter up the info messages that end users get to see.
* | Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-166-39/+39
|/ | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* hspool: Accept any T:CircTarget.Nick Mathewson2023-05-101-9/+26
| | | | | | Previously, we only accepted an OwnedCircTarget, which would have kept us from getting a circuit that was aimed at a specialized CircTarget that gave us LinkSpecs in a raw order.
* ExitPath: Add an explanation of WeightRole::Exit on non-exit circsNick Mathewson2023-04-121-0/+7
| | | | | | | | | In one case, we use WeightRole::Exit on circuits that can't actually be used to exit. This commit adds a comment to explain why, so that we don't wonder about it in the future, and we have some indication of whether it's still appropriate. Closes #785
* circmgr: Mark a number of internal APIs as hs-only.Nick Mathewson2023-04-063-0/+8
| | | | | | This resolves a few dead-code warnings. Closes #801.
* circmgr: Expand an incomplete comment in exitpath.rsNick Mathewson2023-04-061-2/+6
|
* tor-circmgr: HsCircKind: derive EqIan Jackson2023-04-051-1/+1
|
* tor-circmgr: Make take_or_launch_stub_circuit future SendIan Jackson2023-03-301-2/+1
| | | | | thread_rng() isn't Send. We can fix this by not holding it over an await point.
* Add some missing importsIan Jackson2023-03-282-2/+5
| | | | | | | | Now nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets actually works. squash! Add some missing imports
* hspool: simplify loop and add a maximumNick Mathewson2023-03-221-41/+39
|
* hspool: Clarify/document more TODO HS items.Nick Mathewson2023-03-221-2/+8
|
* circmgr: Make a separate SupportedCircUsage for HS stuffNick Mathewson2023-03-221-3/+6
| | | | | This uncovered a bug: NoUsage wasn't correct for Hs circuits because of its behavior with channel_usage().
* circmgr: Declare builder() unconditionally.Nick Mathewson2023-03-221-2/+3
| | | | (Still, only expose it when experimental-api is enabled.)
* hspool: Tweak comments and add more TODOs.Nick Mathewson2023-03-221-10/+33
|
* circmgr: hspool now launches circuits in the background.Nick Mathewson2023-03-221-11/+157
| | | | | | The prediction and scheduling logic here is quite primitive; we should probably refactor it considerably. This should be good enough for now, though.
* circmgr: Add an actual pool to HsCircPool.Nick Mathewson2023-03-222-6/+173
| | | | | | | | We now have support for a pool of pre-build circuits that we can use for HS-related purposes, and we take circuits from this pool as needed. Nothing populates or cleans the circuit pool yet.
* circmgr: Begin an HS circuit pool structureNick Mathewson2023-03-223-0/+162
| | | | | This is now enough to launch circuits on demand. It still needs to pre-build the first three hops, and to retry on failure.
* circmgr: Add a usage for building the beginning of an hs circNick Mathewson2023-03-223-16/+86
| | | | | This only builds the first 3 hops. It can be extended to a fourth hop later -- or not, depending on the circuit kind.
* circmgr: Functions to launch an unmanaged circuit.Nick Mathewson2023-03-222-3/+26
| | | | We'll use this to implement the circuits used by onion circuits.
* remove unused type parametertrinity-1686a2023-03-181-1/+1
|
* Fix a bunch of needless-conversion warnings.Nick Mathewson2023-03-101-1/+0
| | | | | Apparently 1.68 now warns when you call into_iter() on something that's already an iterator. Fair enough. Let's stop doing that.
* Fix an unrelated missing cfg_attr.Nick Mathewson2023-03-081-0/+1
|
* hsclient: Abolish knowledge of HS circuits in circmgrIan Jackson2023-03-012-83/+0
| | | | | | | | | | | Abolish CircMgr::get_or_launch_onion_client and everything to support it. We have decided that `.onion` diversion ccan't/shouldn't occur in tor-circmgr. Probably, it should occur much higher up - arti-client maybe - since it will sometimes need ambient authority (KS_hsc_*). Now all knowledge of HS connections is in tor-hsclient. This gets rid of a layering inversion and the trait needed for tor-circmgr to do the upcall to tor-hsclient.
* Apply rustfmtIan Jackson2023-03-011-5/+10
|
* tor-circmgr: Provide testing feature and TestConfigIan Jackson2023-03-012-0/+46
| | | | Like the similar thing in tor-guardmgr.