summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/usage.rs
Commit message (Collapse)AuthorAgeFilesLines
* circmgr: Mark a number of internal APIs as hs-only.Nick Mathewson2023-04-061-0/+2
| | | | | | This resolves a few dead-code warnings. Closes #801.
* Add some missing importsIan Jackson2023-03-281-1/+4
| | | | | | | | Now nailing-cargo +stable clippy -p tor-hsclient --all-features --all-targets actually works. squash! Add some missing imports
* 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: Add a usage for building the beginning of an hs circNick Mathewson2023-03-221-0/+25
| | | | | This only builds the first 3 hops. It can be extended to a fourth hop later -- or not, depending on the circuit kind.
* circmgr: make some imports conditionalNick Mathewson2022-11-181-2/+1
| | | | | This resolves an "unused import" warning when bridges are not enabled.
* Remove a spurious log that I committed by mistake. Whoops.Nick Mathewson2022-11-151-1/+0
|
* Implement more cases for `DirSpecificTarget`.Nick Mathewson2022-11-151-1/+22
| | | | | | Without this fix, any attempt to actually use a circuit for a `DirSpecificTarget` will fail, since supports() will say false, and `restrict_mut()` will say `NotSupported`.
* tor-circmgr: Make get_or_launch_dir_specific feature-specificIan Jackson2022-10-211-2/+9
|
* circmgr: Plumbing for direct to target directory circuitsIan Jackson2022-10-201-1/+13
| | | | | The target is identified by Into<OwnedChanTarget>. We introduce corresponding TargetCircUsage and SupportedCircUsage.
* channel usage: Rename CU::UserTraffic from CU::ExitIan Jackson2022-08-171-1/+1
| | | | | As suggested in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2827246
* Move ChannelUsage from tor_proto to tor_chanmgrIan Jackson2022-08-171-1/+1
| | | | | | | | | | | Replace Channel::note_usage with Channel::engage_padding_activities, which unconditionally causes the channel to (start to) do netflow padding things. The condition now lives in chanmgr. Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/657#note_2826094
* Provide ChannelUsage and plumb it all the way downIan Jackson2022-08-161-0/+11
| | | | | | | | | | | | | Channel padding depends on what the channel is being used for. We therefore need to let the channel code know this information. The implementation of the per-channel padding control logic will be in the new note_usage function, which for now is simply a stub. A future commit will introduce a `PaddingControlState` which lives in the channel frontend; consult the doc comment for that type to see why the plumbing through the channel manager terminates in the channel frontend.
* tor-netdir: Collapse by_id and by_relay_id into a single fn.Nick Mathewson2022-08-101-4/+5
| | | | | | There are some downstream changes required for this to work, but they are all just unit tests that could no longer infer the type of an Ed25519 key.
* Avoid a simple usage of ed_identity() in circmgr testsNick Mathewson2022-08-021-2/+1
|
* tor-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-021-1/+1
| | | | | | | | | | | | | | We want the set of identities supported by a relay to be extensible in the future with minimal fuss; we'd also like to make working with these ID sets more convenient. To handle that, this commit adds a new trait for "Something that has the same IDs as a relay" and a new object for "an owned representation of a relay's IDs." This commit introduces a similar trait for "Something with a list of SocketAddr, like a relay has." There's no owned equivelent for that, since Vec<SocketAddr> is already a thing. Closes #428.
* tor-netdir: testnet: Make construct_netdir infallible (rustfmt)Ian Jackson2022-06-131-3/+1
| | | | | Run rustfmt. Separate commit to make review of the substantive commit easier.
* tor-netdir: testnet: Make construct_netdir infallibleIan Jackson2022-06-131-1/+0
| | | | | This is a *lot* of unwraps. The function takes no parameters and is used only for testing. It ought to be infallible.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-2/+3
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* Resolve the new `derive_partial_eq_without_eq` lint.Nick Mathewson2022-05-231-1/+1
| | | | It's a little overzealous sometimes, but it's mostly to the good.
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* circmgr: Avoid a race condition in circuit usage restrictionNick Mathewson2022-04-041-5/+7
| | | | | | | | | | | | | | | | | | | | | | We were treating restrict_mut() failures as internal errors, and using internal errors to represent them. But in fact, these failures are entirely possible based on timing. Here's how it happens: * Two different circuit requests arrive at the same time, and both notice a pending circuit that they could use. * The pending circuit completes; both pending requests are notified. * The first request calls restrict_mut(), and restricts the request in such a way that the second couldn't use it. * The second request calls restrict_mut(), and gets a failure. Because of this issue, we treat these errors as transient failures and just wait for another circuit. Closes #427. (This is not a breaking API change, since `AbstractSpec` is a crate-private trait.)
* Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-2/+0
|
* Merge branch 'no-system-time' into 'main'eta2022-03-301-7/+13
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * use wallclock where possible in teststrinity-1686a2022-02-261-0/+2
| |
| * fix teststrinity-1686a2022-02-251-4/+6
| |
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-251-3/+5
| |
* | remove usage of 'token' where it's no longer a tokentrinity-1686a2022-03-271-1/+1
| |
* | implement IsolationHelper for StreamIsolationtrinity-1686a2022-03-251-3/+3
| | | | | | | | but don't use it in a dyn Isolation context
* | move StreamIsolation to isolation moduletrinity-1686a2022-03-241-101/+2
| |
* | move isolation in separate moduletrinity-1686a2022-03-241-323/+2
| |
* | seal trait Isolationtrinity-1686a2022-03-241-1/+11
| |
* | rename *_isolation_group to *_isolationtrinity-1686a2022-03-241-2/+2
| |
* | Expand documentation for isolation traitsNick Mathewson2022-03-171-7/+63
| | | | | | | | | | | | | | These aren't complete yet; I'm just making this commit to capture the notes we took on a pad when we were discussing these APIs. Part of #414.
* | Alternative API for set_isolation_group().Nick Mathewson2022-03-171-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Instead of requiring a `Box<dyn Isolation>`, it now takes either a `Box<dyn Isolation>`, or an arbitrary `T` that implements `Isolation`. This API still allows the user to pass in a `Box<dyn Isolation>` if that's what they have, but it doesn't require them to Box the isolation on their own. Part of #414.
* | add trait to help test isolation related codetrinity-1686a2022-03-161-21/+127
| |
* | add tests on Isolation and fix conditional compilation issuestrinity-1686a2022-03-161-0/+58
| | | | | | | | | | | | it seems I added conditional compilation without noticing it?? and there was some errors when choosing a prefered runtime depending on feature flags
* | refactor restrict_muttrinity-1686a2022-03-161-14/+15
| |
* | replace Arc with Box and use dyn-clonetrinity-1686a2022-03-161-43/+24
| | | | | | | | this also removes JoinResult
* | add some documentation for new traitstrinity-1686a2022-03-161-12/+18
| |
* | replace isolated with compatibletrinity-1686a2022-03-161-13/+13
| | | | | | | | the inverted logic was too easy to mess up
* | use downcast-rs instead of our own AsAnytrinity-1686a2022-03-161-15/+3
| |
* | fix existing teststrinity-1686a2022-03-161-36/+42
| |
* | add a join() on Isolationtrinity-1686a2022-03-161-4/+65
| |
* | testing new api for isolationTrinity Pointard2022-03-161-9/+67
|/
* Add kinds for *most* circmgr errors.Nick Mathewson2022-02-161-3/+4
| | | | There are a couple of tricky ones I'll do separately.
* Tests for TargetPorts::display()Nick Mathewson2022-02-041-1/+12
|
* tor-circmgr: Introduce TargetPorts with a pretty Display implIan Jackson2022-02-041-1/+34
|
* tor-circmgr: impl Display for TargetPortIan Jackson2022-02-041-0/+7
| | | | This will be used for error handling, and perhaps other things.
* StreamPrefs: rename from ConnectPrefsIan Jackson2022-01-211-3/+3
| | | | | | | | | | | | | The docs even say this is about stream. As @nickm writes in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289 we generally call end-to-end connections that are tunneled over Tor "Streams" to distinguish them from everything else in the Tor protocols that could possibly be called a "Connection". That seems to apply here too.
* Allow configurability on preemptive circuitsNeel Chauhan2021-12-071-5/+8
|