Commit Graph

124 Commits

Author SHA1 Message Date
Neel Chauhan 417809123c Make max_file_limit configurable 2022-01-28 11:17:49 +00:00
Nick Mathewson 5dcc821146 Fix documentation references for tor-rtcompat refactoring. 2022-01-26 14:58:28 -05:00
Nick Mathewson 30b3818a9e Make the native-tls crate optional.
This commit puts the native-tls crate behind a feature.  The feature
is off-by-default in the tor-rtcompat crate, but can be enabled
either from arti or arti-client.

There is an included script that I used to test that tor-rtcompat
could build and run its tests with all subsets of its features.

Closes #300
2022-01-26 14:06:58 -05:00
Nick Mathewson 6f29d485e4 Make current/create functions into runtime member functions.
This should help avoid some amount of temptation towards API
proliferation.
2022-01-26 14:06:58 -05:00
Nick Mathewson 2333d0466e Rename FooRuntime to FooNativeTlsRuntime for consistency. 2022-01-26 14:06:58 -05:00
Nick Mathewson 668364d75d Unify TokioRuntime and TokioRuntimeHandle
Having separate types here doesn't justify the (very limited)
benefit of distinguishing between the case where we have created an
executor that we own and the case where we have a handle to an
already-running tokio executor.

Part of #301.
2022-01-26 14:06:58 -05:00
Ian Jackson a79a2e87be Rename TorClient::set_stream_prefs
In line with the rest of the renaming.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/256#note_2771617
2022-01-21 17:12:08 +00:00
Ian Jackson aa4d8de16e StreamPrefs: rename from ConnectPrefs
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.
2022-01-21 11:07:15 +00:00
Ian Jackson 695a33c1fd Merge branch 'always-isolate' into 'main'
Provide isolate-all-streams function

Closes #279

See merge request tpo/core/arti!252
2022-01-20 19:08:05 +00:00
Ian Jackson 7bc8941742 isolation: Rename isolate_every_stream from ..._connection
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771291
2022-01-20 17:53:09 +00:00
Ian Jackson 23c1fc8c56 isolation: Rename (internal) EveryStream enum variant
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289
2022-01-20 17:53:09 +00:00
Nick Mathewson 06c15f21b4 isolation: Much better wording for always isolate setting 2022-01-20 17:52:10 +00:00
Ian Jackson ced24b1974 connection preferences: Make `set_default_prefs` private for now 2022-01-20 13:52:30 +00:00
Ian Jackson e04e41a1db connection preferences: Make `clone_with_prefs` must_use
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/250#note_2771239
2022-01-20 13:50:12 +00:00
Ian Jackson 9e904167e4 isolation: Provide isolate-every-connection option 2022-01-20 12:08:22 +00:00
Ian Jackson a5356aed65 isolation: Provide new_isolation_group method
In the usual case, set_isolation_group is awkward.

This is perhaps slightly duplicative with TorClient::isolated_client().
If so then perhaps the *latter* should be abolished.
2022-01-20 12:08:22 +00:00
Ian Jackson 639db26d58 isolation: Refactor to introduce a bespoke enum
No functional change.

This will grow a new variant shortly.
2022-01-20 12:08:22 +00:00
Ian Jackson 7ff16fc252 connection preferences: Provide `clone_with_prefs` method 2022-01-19 17:45:59 +00:00
Ian Jackson 4ddbb3daeb connection preferences: Provide `set_connect_prefs` method 2022-01-19 17:45:59 +00:00
Ian Jackson dec0e1e756 connection preferences: Take ConnectPrefs by reference
This may save quite a bit of copying.  The callees don't need to copy
the whole struct; they copy the bits they need.
2022-01-19 17:42:43 +00:00
Ian Jackson 1437f953b6 connection preferences: Rename variable and docs to not say "flags"
These aren't flags.  Eg, there's an isolation token in there.
2022-01-19 17:39:29 +00:00
Ian Jackson e84ff24d11 isolation: Document orthogonality of isolated_client and isolation_group 2022-01-19 17:39:29 +00:00
Nick Mathewson db2ca6ebc4 Merge branch 'bootstrap_reporting' 2022-01-19 08:40:36 -05:00
Nick Mathewson 79e6dc1d4b Put our cache files in the right place.
This resolves a copy-and-paste error where we were putting
everything in our state directory.

Closes #297.
2022-01-18 13:32:06 -05:00
Nick Mathewson 41e3498f8a Integrate status information at arti-client
This commit combines status update information from tor-dirmgr and
tor-chanmgr in the arti-client crate, so that the user can get to
it; it represents a high-level view of the client's ability to reach
the network and route traffic.

I have omitted the tor-circmgr support for now; it's mostly not
needed.

At present it's not so useful, since there's no way for a client to
get a TorClient that _isn't_ completely bootstrapped, and therefore
there's no way to actually watch these events until they're no
longer interesting.  That should change with arti#293.

This is part of #96.
2022-01-18 13:27:56 -05:00
Nick Mathewson 1bd2790d51 Implement the basics of a bootstrap-status API.
The purpose of a this API is to tell the user how far along Arti is
in getting bootstrapped, and if it's stuck, what it's stuck on.

This API doesn't yet expose any useful information: by the time it's
observable to a client, it's always "100% bootstrapped."  But I'm
putting it in a MR now so that we can review the basic idea, and to
avoid conflicts with later work on tickets like #293 and #278.

This is part of #96.
2022-01-13 10:29:49 -05:00
Nick Mathewson b4761f8cfd Merge branch 'eta/182' into 'main'
Improve the layout of crate exports; add runtime convenience functions

See merge request tpo/core/arti!235
2022-01-11 18:42:15 +00:00
eta 41e202a3a4 Improve the layout of crate exports; add runtime convenience functions
This commit addresses multiple problems highlighted by arti#182:

- `arti-client` had some types in its public API that weren't accessible
  without importing another crate (`CfgPath`, `DataReader`,
  `DataWriter`). This has been fixed.
  - In addition, the doc comments for `DataReader` and `DataWriter` were
    cleaned up to be of better quality, now that they're public.
- It was impossible to use `arti-client` without also importing
  `tor-rtcompat`. This is now fixed by the addition of two convenience
  methods: `TorClient::bootstrap_with_tokio` and
  `TorClient::bootstrap_with_async_std`.
- Potentially controversially: `tor-rtcompat` now returns *concrete*
  types from methods like `current_runtime`, instead of `impl Runtime`.
  - This was needed in order to actually be able to name the `TorClient`
    type that results from using these methods.
  - This does mean we lose API flexibility, but on balance I think this
    is a good thing, because the API we *do* have is actually usable...
2022-01-11 15:16:03 +00:00
Nick Mathewson 7d3482ca1a Bump all crate versions to 0.0.3. 2022-01-11 09:40:32 -05:00
Nick Mathewson c5f50b7d41 Update README.md files (automated) 2022-01-11 09:37:45 -05:00
eta c42fac09a5 Merge branch 'ticket_281' into 'main'
Expose and rename stream timeout config.

Closes #281

See merge request tpo/core/arti!231
2022-01-10 15:05:31 +00:00
Nick Mathewson 01c851ad46 Expose and rename stream timeout config.
Previously we kept this in an ambiguously named type,
`ClientTimeoutConfig`. But everything we do right now is client
related! So `StreamTimeoutConfig` is a better name.

Also, we'd previously neglected to expose the builder for this type
from `TorClientConfigBuilder`. Now we do.

Closes #281.
2022-01-10 09:46:43 -05:00
Nick Mathewson 7819dd7bac Make the arti_client::Result type public.
Closes #280.
2022-01-10 09:33:26 -05:00
eta e6e65d6574 Merge branch 'minimize_deps' into 'main'
Minimize the required version for each dependency.

Closes #275

See merge request tpo/core/arti!228
2022-01-10 13:44:53 +00:00
Neel Chauhan 439b8b3e64 Use *_with_prefs() for Option<ConnectPrefs> callers in TorClient::connect 2022-01-08 13:36:49 -08:00
Nick Mathewson 4841b50c9f Minimize the required version for each dependency.
I found these versions empirically, by using the following process:

First, I used `cargo tree --depth 1 --kind all` to get a list of
every immediate dependency we had.

Then, I used `cargo upgrade --workspace package@version` to change
each dependency to the earliest version with which (in theory) the
current version is semver-compatible.  IOW, if the current version
was 3.2.3, I picked "3".  If the current version was 0.12.8, I
picked "0.12".

Then, I used `cargo +nightly upgrade -Z minimal-versions` to
downgrade Cargo.lock to the minimal listed version for each
dependency.  (I had to override a few packages; see .gitlab-ci.yml
for details).

Finally, I repeatedly increased the version of each of our
dependencies until our code compiled and the tests passed.  Here's
what I found that we need:

anyhow >= 1.0.5: Earlier versions break our hyper example.

async-broadcast >= 0.3.2: Earlier versions fail our tests.

async-compression 0.3.5: Earlier versions handled futures and tokio
    differently.

async-trait >= 0.1.2: Earlier versions are too buggy to compile our
    code.

clap 2.33.0: For Arg::default_value_os().

coarsetime >= 0.1.20: exposed as_ticks() function.

curve25519-dalek >= 3.2: For is_identity().

generic-array 0.14.3: Earlier versions don't implement
    From<&[T; 32]>

httparse >= 1.2: Earlier versions didn't implement Error.

itertools at 0.10.1: For at_most_once.

rusqlite >= 0.26.3: for backward compatibility with older rustc.

serde 1.0.103: Older versions break our code.

serde_json >= 1.0.50: Since we need its Value type to implement Eq.

shellexpand >= 2.1: To avoid a broken dirs crate version.

tokio >= 1.4: For Handle::block_on().

tracing >= 0.1.18: Previously, tracing_core and tracing had separate
    LevelFilter types.

typenum >= 1.12: Compatibility with rust-crypto crates

x25519-dalek >= 1.2.0: For was_contributory().

Closes #275.
2022-01-07 19:08:58 -05:00
Ian Jackson d63a251afc tor-circmgr: Remove Arc around ClientCirc
See the new commentary text on `ClientCirc` for the rationale.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2022-01-07 18:19:20 +00:00
Daniel Eades 592642a9e6 extend lints to include 'clippy::all' 2021-12-28 20:15:40 +00:00
eta 0cdf65c256 Merge branch 'refactor/must-use-self' into 'main'
address clippy's latest lint

See merge request tpo/core/arti!205
2021-12-20 18:38:18 +00:00
Nick Mathewson f73f6a4e80 arti-client: Change an XXXX to a TODO.
We _do_ reject bad hostnames: just not where I once thought we might.
We need to decide if the current behavior is what we want (and I think
it is, probably?).
2021-12-20 10:02:24 -05:00
Daniel Eades 9b51a52b53 address clippy's latest lint 2021-12-20 09:46:41 +00:00
eta 8040f7afb2 Merge branch 'reconfigure' into 'main'
Make most arti-client fields reconfigurable.

See merge request tpo/core/arti!181
2021-12-13 14:49:23 +00:00
Trinity Pointard 2339370a85 drop arcs before awaiting 2021-12-09 13:11:09 +01:00
Trinity Pointard 9753a7ee06 fix nightly clippy errors 2021-12-09 12:16:23 +01:00
Nick Mathewson 1ff5a513ae Oops: MutCfg shouldn't implement Clone.
We don't want MutCfg to be automatially coneable, or we'll wind up with
surprises like the one that this patch fixes in TorClient.

(The "surprise" is that reconfigure() would only apply its
client-specific options  to one client instance.)
2021-12-07 17:54:24 -05:00
Nick Mathewson 953ee93533 Sequence reconfiguration requests.
If we allow overlapping reconfiguration requests, we introduce all
kinds of "fun" bugs.  For example, we could wind up with a configuration
made up of parts of one reconfiguration attempt, and parts of another.
2021-12-07 17:49:03 -05:00
Nick Mathewson 7ac6870a0d Improve documentation of which config can change.
It no longer makes sense to say "most things can't change", now that
most things can.
2021-12-07 17:41:05 -05:00
Nick Mathewson 2689d810bf Make TorClient reconfigurable.
This covers ClientAddrConfig and ClientTimeoutConfig.
2021-12-07 16:58:41 -05:00
Nick Mathewson 99fb41218d Add new configuration objects to reconfigure.
(These weren't in the codebase when I started the first version of
this branch.)
2021-12-07 15:47:25 -05:00
Nick Mathewson 11210124da Allow on-the-fly changing of path_rules
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. ;)
2021-12-07 15:42:14 -05:00