summaryrefslogtreecommitdiff
path: root/tor-circmgr/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* More tests and a little code-golf for coverage on tor-circmgrNick Mathewson2021-06-201-0/+16
|
* A few tests for circparameters generation.Nick Mathewson2021-06-191-0/+31
|
* Misc tests in tor-proto.Nick Mathewson2021-06-191-1/+4
|
* Run "typos" to fix a few more typos.Nick Mathewson2021-06-171-1/+1
|
* remove now-unused importsNick Mathewson2021-06-141-5/+0
|
* Comment out build_path for now.Nick Mathewson2021-06-141-0/+3
| | | | | It just duplicates TorPath::build_circuit, which is all you actually need.
* Enormous tor-circmgr rewrite.Nick Mathewson2021-06-141-378/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As with the tor-chanmgr code, the circuit manager is now implemented using an AbstractCircMgr type that uses traits to abstract the particular behavior of other types that it uses. (Specifically: circuits, building circuits, and telling whether one circuit usage is compatible with another.) Abstracting out the dependencies in this ways makes it possible to test the circuit manager without having to actually build real circuits. This commit also introduces new behavior for handling pending circuit requests. Upon getting a new request, first we check to see if there's an existing circuit we can use. If there isn't, we look for pending circuits and wait for them. If there aren't any pending circuits we can use, we launch one or more, and wait for them. So far, that's the same as the old behavior. But here's a change: if, while we are waiting for some pending circuits, a different circuit is completed, and it's one we could use, then the task that was building _that_ circuit will tell us: "please look at this circuit". This gives us better changes of getting a usable circuit fast. Minor changes: * The Error type in CircMgr no longer uses anyhow; several errors have been simplified. * We've gotten more formal about the relationship between circuit usage and target usage.
* Missing experimental-api imports.Nick Mathewson2021-06-031-1/+3
|
* cirmgr: Move usage-related code into a submodule, and refactor.Nick Mathewson2021-06-021-132/+7
|
* Add noop_method_call warning.Nick Mathewson2021-05-271-0/+1
| | | | | | This would have saved ahf and me a lot of confusion in debugging a situation where we were cloning a reference of a type that didn't implement Clone.
* Enable cargo_common_metadata warning.Nick Mathewson2021-05-251-0/+1
|
* Module docs for remaining cratesNick Mathewson2021-05-251-3/+16
|
* Use macros and types to improve handling of Netdir parameters.Nick Mathewson2021-05-251-4/+3
| | | | (Squashed from typed-netdir-params)
* Refactor TorPath code to have explicit constructors.Alexander Færøy2021-05-201-1/+1
| | | | | | | | | This patch refactors the internal representation of the TorPath type to use an enum for representing its state. We add explicit constructor methods to create the different types of path's, such that client users can write code that uses different paths based on their need. This work was done together with Nick as part of the Arti hackathon.
* Add the "unreachable_pub" lint.Nick Mathewson2021-05-181-0/+1
| | | | | | This is a somewhat obnoxious change in its scope and requirements, but it makes it easier to understand what the real public and private parts of our APIs are.
* Add trait_duplication_in_bounds warning.Nick Mathewson2021-05-031-0/+1
|
* Add unseparated_literal_suffix lint, and fix it.Nick Mathewson2021-05-031-0/+1
|
* Add a few more clippy warningsNick Mathewson2021-05-031-0/+5
|
* Fix experimental-api feature after refactoringDavid Goulet2021-05-031-3/+5
| | | | | | | | | Important refactoring happened recently which broke the "experimental-api" feature. Fixes are quite simple. Signed-off-by: David Goulet <[email protected]>
* Add some more clippy warnings to our list.Nick Mathewson2021-04-271-1/+6
|
* Enforce (and obey) clippy lints about exhaustive enums, structs.Nick Mathewson2021-04-271-0/+4
| | | | | | | | These lints force us to declare our exported enums and exhaustive-looking structs as non-exhaustive (so that we can add to them in the future without breaking our API) or to explicitly disable the warning for a given enum/struct (to say that we _intend_ for additions to be a breaking change).
* Move timer functions into an extension trait.Nick Mathewson2021-04-171-7/+5
|
* Move around the public modules in tor_rtcompat.Nick Mathewson2021-04-171-1/+1
|
* Remove all non-runtime methods in tor_rtcompat.Nick Mathewson2021-04-161-4/+14
|
* Add a "Runtime" parameter to all the manager types.Nick Mathewson2021-04-161-4/+5
| | | | | This is a big change, but it is a step towards our goal of removing tor_rtcompat:: calls directly.
* circmgr: Add missing rng trait to build_path()David Goulet2021-04-091-1/+4
| | | | Signed-off-by: David Goulet <[email protected]>
* circmgr: Add a function to build a circuit by pathDavid Goulet2021-04-071-0/+19
| | | | | | | Public function so an application can use to build a circuit using a custom path. Signed-off-by: David Goulet <[email protected]>
* Fix a bunch more new clippy lints in Rust 1.51Nick Mathewson2021-03-291-6/+6
| | | | | | | | The major types are: * You implemented Into when you should have implemented From. * You sliced a slice when you didn't have to. * You said Ok(x?) when you could have said x. * You said Vec::new(); push(); push(); when you could have said vec![].
* Don't copy exit policies around; instead use Arc.George Kadianakis2021-03-291-2/+2
|
* Use expect() instead of unwrap() in tor-circmgrNick Mathewson2021-03-041-4/+12
|
* Make authorities and fallbacks configurable.Nick Mathewson2021-02-111-3/+3
| | | | | | | | | | This commit adds configuration options for these values, with the right defaults, and uses those options instead of built-in functions to set them. We also remove the function to extract information from chutney directories: now that arti is configurable, it can be chutney's job to make its own network configurations.
* More logging in circmgr.Nick Mathewson2021-01-261-5/+25
|
* Cleanup on DirInfo::circ_params.Nick Mathewson2020-12-221-8/+15
|
* Implement the "circwindow" and "ExtendByEd25519ID" parametersNick Mathewson2020-12-221-2/+18
| | | | | | These necessitated a little complexity for our circuit creation/extension API; we might want to refactor that down the road.
* Check ipv6 exit policies when trying to connect to an ipv6 port specificallyNick Mathewson2020-12-221-0/+9
|
* Write a few misc unit testsNick Mathewson2020-12-151-1/+1
|
* Basic support for IPv6 and begin flags.Nick Mathewson2020-12-151-11/+21
| | | | | | We now have a way to tell a circuitmgr whether we require ipv4/ipv6 support for a target address in an exit policy, and we use similar logic to set begin flags.
* Implement a notion of "circuit dirtiness", as in Tor.Nick Mathewson2020-12-151-6/+33
|
* Fix some clippy warnings.Nick Mathewson2020-12-151-3/+7
|
* circmgr: refactor and bugfix a bit.Nick Mathewson2020-12-141-28/+83
| | | | | | | | Notably, turn the hashmap into its own type. This will help with other refactoring and fixes in the future. Also notably, fix the code we use when a pending circuit is complete. There's still a design flaw there though.
* tor-circmgr: update documentationNick Mathewson2020-12-141-1/+18
|
* Give more information if we fail to create a pending circuit.Nick Mathewson2020-12-141-5/+7
|
* Remove now-unused busted From<TargetCircUsage> for CircUsageNick Mathewson2020-12-141-19/+0
|
* tor-circmgr: always remove closed circuits from the list.Nick Mathewson2020-12-141-8/+8
|
* tor-circmgr: Use a better key type for our circuit map.Nick Mathewson2020-12-141-70/+88
| | | | | | | We now use the unique id of each non-pending circuit as its key in the map. I wish I could do this without copying, but I don't see a great way to do that while keeping the pending entries in the same map for now.
* Remember the actual usable ports for an exit after we've built a circuitNick Mathewson2020-12-141-47/+128
| | | | | | | | Previously we'd just remember the port that we _wanted_ a circuit for, and forget all the ports that it _could_ support. This is part of a bigger circmgr revision/refactoring pass; there should be cleanups before I merge this.
* De-parameterize ChanMgr and everything that wraps it.Nick Mathewson2020-12-081-11/+4
| | | | | | | | | | | | | | This makes a whole lot of our code simpler, and makes it so that CircMgr and DirMgr no longer need to have anything parameterized over transports, either. Instead of boxing Transport inside of ChanMgr, I've made a new Connection trait that goes from a ChanTarget* straight to a Channel. This lets us avoid having to box the intermediate TLS object. [*] Actually, a copy of the information from a ChanTarget. Ick, but I had to make a copy to avoid parameterizing Connecter::build_channel.
* Mark some XXXX issues as XXXX-A1.Nick Mathewson2020-12-071-6/+4
|
* When retiring circuits, do it by ID, not by reference.Nick Mathewson2020-12-011-8/+8
|
* tor-dirclient: add timeoutsNick Mathewson2020-12-011-2/+2
| | | | | | | | This adds two timeouts in total: one for sending begin, and getting headers, and one for getting the rest of the data. These timeouts are way too long right now, but at least the code is there.