summaryrefslogtreecommitdiff
path: root/crates/tor-circmgr/src/usage.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-circmgr: Rename pick_path to pick_path_with_vanguards.Gabriela Moldovan2024-03-201-1/+1
| | | | | | When the `vanguards` feature is enabled, we define `pick_path_with_vanguards` instead of `pick_path`, rather than conditionally defining 2 different versions of the same function.
* tor-circmgr: Give pick_path a VanguardMgr (fmt).Gabriela Moldovan2024-03-201-4/+36
|
* tor-circmgr: Give pick_path a VanguardMgr.Gabriela Moldovan2024-03-201-6/+26
|
* tor-circmgr: Tell HsPathBuilder what kind of circuit stub is needed (fmt).Gabriela Moldovan2024-03-201-5/+2
|
* tor-circmgr: Tell HsPathBuilder what kind of circuit stub is needed.Gabriela Moldovan2024-03-201-2/+8
|
* tor-circmgr: Move pick_path out of AnonymousCircuitBuilder.Gabriela Moldovan2024-03-141-3/+1
| | | | This enables us to make `AnonymousCircuitBuilder` private.
* tor-circmgr: Remove unused require_stability.Gabriela Moldovan2024-03-141-3/+0
|
* tor-circmgr: Use HsPathBuilder instead of ExitPathBuilder.Gabriela Moldovan2024-03-141-6/+7
|
* tor-circmgr: Implement AnonymousPathBuilder for ExitPathBuilder.Gabriela Moldovan2024-03-141-1/+3
|
* Annotate remaining "TODO #504" comments explaining why they are there.Nick Mathewson2024-03-121-4/+14
|
* circmgr: Rename "any exit" code to reflect its real purposeNick Mathewson2024-03-121-1/+1
| | | | | (These functionalities are for onion service circuits, and don't actually need to go to an exit at all.)
* New crate to define a high-level API for relay selectionNick Mathewson2024-03-121-45/+2
|
* Mark code with "TODO #504" and "TODO #789".Nick Mathewson2024-02-221-0/+5
| | | | | | | | I've done this by looking for every non-test instance of pick_relays or pick_n_relays, and for every non-test usage of any non-ID-related method on Relay or UncheckedRelay. Part of #504.
* Teach *CircUsage structs about stability.Nick Mathewson2024-02-201-12/+57
| | | | | | | | | | | This lets us check long_lived_ports only when we are constructing a TargetCircUsage, and lets us remember whether or not the circuit we've built is suitable for non-long-lived ports. It also lets us decide whether existing circuits are compatible with new requests. Closes #1100.
* Add a couple of TODOs about Stable-based path selection.Nick Mathewson2024-02-201-0/+2
|
* When building paths, require the Stable flag as appropriateNick Mathewson2024-02-201-2/+12
| | | | | | | | | | | | The Stable flag means that circuits build through a given relay are not likely to get closed precipitously. (Currently, the authorities guess this by looking at the relay's mean time between failures.) Generally speaking, paths must be Stable if: * They are going to get used for a rendezvous point. * They are going to get used for an introduction point. * They are going to get used for exiting to a member of long_lived_ports.
* Downgrade some messages to traceIan Jackson2023-11-291-2/+2
| | | | | These messages are very verbose and I doubt anyone will want them, usually, even when debugging.
* arti-client: add exit selection with GeoIP country codeseta2023-09-181-6/+89
| | | | | | | | | | | | | | | | | | | | This threads the country codes work through the rest of the codebase: - `tor-dirmgr` will now enable GeoIP with the embedded database when the `geoip` future is enabled - This can be extended later using the `DirMgrConfig` to allow specifying a custom database; this is not done here, though - `tor-circmgr`'s `SupportedCircUsage` and `TargetCircUsage` fields gain new `country_code` members to allow filtering circuits by country - These are `()` in builds where the `geoip` feature is not enabled -- doing it this way means we don't have to copy and paste huge swathes of code, since we can't use `#[cfg]` in patterns - `ExitPathBuilder` gains (hacked-in) support for choosing a relay with the correct country code - Due to the lack of conjuction, we just copy and paste a small bit, pending further refactoring - `StreamPrefs` now lets you specify a country code, letting embedders make use of the feature
* 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
| |