summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/build.rs
Commit message (Collapse)AuthorAgeFilesLines
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* circmgr: Use event_report!() and similar macrosNick Mathewson2023-07-071-3/+2
| | | | This simplifies our logging a little, and implements part of
* tor-circmgr: Expose CircParameters from NetParameters constructionIan Jackson2023-06-291-0/+13
| | | | | | | | As per #935. I called this "circparameters_from_netparameters" not "circparameters_from_netparams" because the type is "NetParameters" not "NetParams".
* circmgr: New API to expose estimate-based timeouts.Nick Mathewson2023-06-221-2/+0
| | | | | This will help create good timeout values for various onion-service operations.
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-12/+12
| | | | | | | | | | | | 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.
* 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.
* circmgr: Begin an HS circuit pool structureNick Mathewson2023-03-221-0/+10
| | | | | This is now enough to launch circuits on demand. It still needs to pre-build the first three hops, and to retry on failure.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* tor-cirmgr: Replace OwnedChanTarget with LoggedChanTarget in errorsIan Jackson2022-11-231-4/+4
| | | | | | | | | This 1. Makes the errors smaller 2. Redacts (currently, scrubs) the chantarget when safe logging is enabled The other error variants in tor-circmgr::Error don't seem to contain information that should become sensitive as part of bridge support.
* tor-linkspec: Remove the old OwnedFoo::new() functionsNick Mathewson2022-10-061-2/+15
| | | | These are now builders.
* channel usage: Rename CU::UserTraffic from CU::ExitIan Jackson2022-08-171-4/+4
| | | | | 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-4/+3
| | | | | | | | | | | 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
* chanmgr: Use NetDirProvider::params and Arc<dyn..Netparameters>Ian Jackson2022-08-171-0/+1
| | | | | | | | | This gets rid of many Result(). Many parameters are renamed. Test cases of the now-impossible branch are removed. Deleting the match from padding_parameters will come in a moment. I've split off that commit since it has much whitespace noise. for now, change the error type to Void.
* Introduce ChannelConfigIan Jackson2022-08-161-1/+6
| | | | | This commit is just the necessary plumbing. The config is currently empty. We'll add something to it, for padding control, later.
* Provide ChannelUsage and plumb it all the way downIan Jackson2022-08-161-12/+43
| | | | | | | | | | | | | 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.
* dormancy: Plumb through to chanmgr reconfigure_generalIan Jackson2022-08-161-1/+1
| | | | | | | | | | | | | | | The chanmgr remembers the last dormancy state it was told. We invent a chanmgr-specific Dormancy which the arti-client code knows how to convert from the richer top-level dormant status. This avoids having to have everyone know all the variants of the top-level state. To call reconfigure_general, we must also obtain and plumb through a netdir. Right now we must return an internal error if there is in fact no netdir, because reconfigure_general does not yet cope with a missing netdir. Nothing actually *uses* the dormancy yet.
* Use accessors in two places where tests look at specific keys.Nick Mathewson2022-08-101-7/+17
| | | | | | (It's safe to require these specific keys, since we constructed the objects for testing, and we know for certain that they contain given keys.)
* Introduce HasRelayIds::same_relay_ids.Nick Mathewson2022-08-021-7/+11
| | | | | This method tells if two HasRelayIds contain exactly the same set of Relay identities, and is generally useful for debugging.
* tor-linkspec: Refactor out traits to represent a relay's ID set.Nick Mathewson2022-08-021-0/+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-circmgr: Clarify and improve Protocol error.Nick Mathewson2022-07-121-0/+4
|
* 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.
* Create and use API to report guard/fallback skew.Nick Mathewson2022-04-071-12/+39
| | | | (The information is not yet recorded.)
* ChanMgr: Return provenance information from get_or_launchNick Mathewson2022-04-071-7/+8
| | | | | | We need this since we want to report certain conditions only when they happen on a new channel, not if we observe them on a preexisting channel.
* Merge branch 'no-system-time' into 'main'eta2022-03-301-0/+10
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * typotrinity-1686a2022-02-281-1/+1
| |
| * remove most usage of SystemTime::nowtrinity-1686a2022-02-251-0/+10
| |
* | Expand some comments based on review from @diziet.Nick Mathewson2022-03-211-1/+4
| |
* | Expose more peer information from circuit build failuresNick Mathewson2022-03-211-5/+22
|/ | | | | | | | | We already have the ability to get peer information from ChanMgr errors, and therefore from any RetryErrors that contain ChanMgr errors. This commit adds optional peer information to tor-proto errors, and a function to expose whatever peer information is available.
* Make NoLock into BadApiUsage.Nick Mathewson2022-02-221-3/+8
| | | | | | To implement this, we had to refactor the tor_circmgr api for flushing state changes to disk, so that it checks if it has the lock, and only then tries to store.
* Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-041-5/+8
| | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)
* errors: Drop "Error" and "Failed" from various enum variantsIan Jackson2022-02-041-1/+1
|
* tor-circmgr: Handle channel creation errors in the new styleIan Jackson2022-02-041-1/+7
|
* Untangle two needless Ok(r?) into just rIan Jackson2022-02-021-1/+1
| | | | | | Prompted by clippy::needless_question_mark. Sometimes Ok(r?) is needed to do automatic error conversion. I assume the lint checks for that. Anyway, in these cases it's not needed.
* Merge branch 'remove-type-annotation' into 'main'Nick Mathewson2022-01-071-1/+1
|\ | | | | | | | | tor-circmgr: Remove a type annotation in a method call See merge request tpo/core/arti!225
| * tor-circmgr: Remove a type annotation in a method callIan Jackson2022-01-071-1/+1
| | | | | | | | | | | | | | | | This is a method, so the resolution is automatic. It's not clear to me why this was written out this way, given that extend_ntor is right above. Signed-off-by: Ian Jackson <[email protected]>
* | De-Arc-ify Buildable for ClientCircNeel Chauhan2022-01-061-13/+6
|/
* Merge branch 'main' into 'remove_unused_rngs'eta2022-01-061-2/+1
|\ | | | | | | # Conflicts: # crates/tor-circmgr/src/build.rs
| * tor-circmgr: Don't clone parameters in create_chantarget()Neel Chauhan2021-12-251-2/+1
| |
* | Remove a bunch of unused RNGsNeel Chauhan2021-12-251-48/+22
|/
* Allow on-the-fly changing of path_rulesNick Mathewson2021-12-071-4/+9
| | | | | | | | | | | | And now the complexity begins: when the user changes the path_rules, they not only want new circuits to obey those rules: they want _all new requests_ to be put onto circuits that obey those rules. That means that when the path rules become more restrictive, we need to retire all the circuits, and make sure that currently pending circuits aren't used for any requests. If it's any comfort, doing this was even more complicated in C tor. ;)
* Sketch API for reconfiguration.Nick Mathewson2021-12-071-5/+5
| | | | | | | This patch doesn't actually make anything reconfigurable, but it does create an API that will tell you "you can't change the value of that!" If the API looks reasonable, I can start making it possible to change the values of individual items.
* add semicolons if nothing returnedDaniel Eades2021-11-251-2/+2
|
* Completely overhaul the tor-proto circuit reactoreta2021-11-121-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather like e8e9699c3c239d6c30f9ad414f15d3bad6ec03fd ("Get rid of tor-proto's ChannelImpl, and use the reactor more instead"), this admittedly rather large commit refactors the way circuits in `tor-proto` work, centralising all of the logic in one large nonblocking reactor which other things send messages into and out of, instead of having a bunch of `-Impl` types that are protected by mutexes. Congestion control becomes a lot simpler with this refactor, since the reactor can manage both stream- and circuit-level congestion control unilaterally without having to share this information with consumers, meaning we can get rid of some locks. The way streams work also changes, in order to facilitate better handling of backpressure / fairness between streams: each stream now has a set of channels to send and receive messages over, instead of sending relay cells directly onto the channel (now, the reactor pulls messages off each stream in each map, and tries to avoid doing so if it won't be able to forward them yet). Additionally, a lot of "close this circuit / stream" messages aren't required any more, since that state is simply indicated by one end of a channel going away. This should make cleanup a lot less brittle. Getting all of this to work involved writing a fair deal of intricate nonblocking code in Reactor::run_once that tries very hard to be mindful of making backpressure work correctly (and congestion control); the old code could get away with having tasks .await on things, but the new reactor can't really do this (as it'd lock the reactor up), so has to do everything in a nonblocking manner.
* Add a couple of pieces of missing documentation.Nick Mathewson2021-11-081-1/+1
|
* Replace all println/eprintln calls outside of arti CLI with trace.Nick Mathewson2021-11-041-3/+4
|
* Remove all remaining dbg! instances.Nick Mathewson2021-11-041-5/+0
|
* Get rid of tor-proto's ChannelImpl, and use the reactor more insteadeta2021-11-031-2/+4
| | | | | | | | | | | | | | | | | | | Instead of awkwardly sharing the internals of a `tor-proto` `Channel` between the reactor task and any other tasks, move most of the internals into the reactor and have other tasks communicate with the reactor via message-passing to allocate circuits and send cells. This makes a lot of things simple, and has convenient properties like not needing to wrap the `Channel` in an `Arc` (though some places in the code still do this for now). A lot of test code required tweaking in order to deal with the refactor; in fact, fixing the tests probably took longer than writing the mainline code (!). Importantly, we now use `tokio`'s `tokio::test` annotation instead of `async_test`, so that we can run things in the background (which is required to have reactors running for the circuit tests). This is an instance of #205, and also kind of #217.
* Fix clippy warnings in tests.Nick Mathewson2021-10-281-5/+5
|
* tor_circmgr: Refactor and re-enable build_timeout() testNick Mathewson2021-10-271-136/+233
| | | | | | | | | | | | | | | | | | | The previous version of this test used the old, racy version of wait_for (see #149). The new version is refactored so that simulated time is only allowed to advance after each step is done, so that we can actually be sure that each step in the process will happen as it should. In order to get the time-advances to proceed properly, and avoid polluting state between tests, I've had to introduce some machinery to encode the proper amount for time to advance. It isn't something I'd want to use for a whole bunch of tests, but for just one set, it's fine. These tests now pass reliably for me. I wonder if a discrete-event-simulation approach (hello, Shadow) would let us write tests like these to our hearts' content?