aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/usage.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Merge remote-tracking branch 'origin/mr/154'Nick Mathewson2021-11-301-4/+77
|\
| * Add tests & address review commentaryeta2021-11-301-15/+28
| |
| * Actually build preemptive circuits (and minor fixes)eta2021-11-291-0/+7
| | | | | | | | | | | | The new CircMgr::build_circuits_preemptively function actually causes preemptive circuits to be built; it gets called from arti-client, like the other daemon tasks the CircMgr has.
| * Introduce PreemptiveCircuitPredictor and TargetCircUsage::Preemptiveeta2021-11-231-1/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for making Arti build circuits preemptively, this commit introduces `TargetCircUsage::Preemptive`, a circuit usage that works somewhat differently from other ones: it requires at least 2 circuits to exist that can exit the port it contains in order for an existing circuit to match against it (path-spec.txt § 2.1.1); if that's not the case, that usage will require building new circuits (in order that we build enough to have 2 available). This required refactoring how circuit reuse worked; now, `CircList::find_open` uses the new `AbstractSpec::find_supported` trait method, which we customize to implement the above check in the case of `Preemptive` circuit usages. To make that work, `OpenEntry` now takes two type parameters (the spec and circuit types), instead of taking a builder type parameter and using its associated types. (We also got rid of type constraints on that struct, yay!) A WIP implementation of a preemptive circuit predictor that implements path-spec.txt § 2.1.1 is also included, but this will require additional effort to wire it up with the `CircMgr` properly.
* | tor-circmgr: Write a test for BadExit support.Neel Chauhan2021-11-291-6/+20
|/
* Fix typosDimitris Apostolou2021-11-121-1/+1
|
* tor-circmgr: testing for NoUsage and TimeoutTesting usageNick Mathewson2021-11-021-0/+24
| | | | This doesn't add much to coverage, but it's important.
* tor-circmgr: tests for netwoks with no exitsNick Mathewson2021-11-021-25/+45
|