Commit Graph

694 Commits

Author SHA1 Message Date
Nick Mathewson 75d977a259 Impl and test Default for high-level configs 2021-11-25 09:39:11 -05:00
Nick Mathewson 17266305e2 Ensure that all config sections have deny_unknown_fields
When we deserialize a configuration, we should reject unknown variables
(except when we have an explicit reason to allow them).
2021-11-25 09:39:11 -05:00
Nick Mathewson ecf462e4ef Make directory accessors crate-private.
These don't need to be exposed any longer.
2021-11-25 09:39:10 -05:00
Nick Mathewson 53d5f647b2 Define defaults for StorageConfig
I'm still not 100% sure this is the right move: should we encourage
app developers to always pick their own directories? Or should we
make it easy for them to use, well, `sane_defaults`?

This patch takes the second approach.
2021-11-25 09:39:09 -05:00
Daniel Eades db16d13df4 add semicolons if nothing returned 2021-11-25 13:20:37 +00:00
Daniel Eades 052f51ff71 deglob some enums, use concise iteration syntax 2021-11-25 12:39:52 +00:00
Nick Mathewson fbf72fd5af Resolve a pair of rustdoc warnings. 2021-11-24 18:24:47 -05:00
Nick Mathewson 3e7e599a22 More typo fixes that I forgot to save :( 2021-11-24 18:23:12 -05:00
Nick Mathewson f55950ab8d Fix a few typos.
Also fix some commonwealth spellings that had slipped in.
2021-11-24 18:12:44 -05:00
Nick Mathewson 307ca9b4d0 Implement meta-builder pattern for TorClientConfig
This should be ergonomic than having to construct every section of the
configuration separately.
2021-11-22 14:53:52 +00:00
Nick Mathewson 40ff7113d4 Make every Config type implement Eq.
Doing this is necessary for reconfiguration support, and will help a lot
with testing, too.
2021-11-21 12:06:15 -05:00
Nick Mathewson e7fdf05f50 For every* config type, make defaults consistent.
This patch makes sure that for every* config type we have, the defaults
you get from a Builder match those you get from Serde, and that both
match the value that you get from arti_defaults.toml. Later down the
line I'll be adding some tests to keep these in sync.

* StorageConfig still has no defaults of its own, since we aren't so
sure we want other applications to use Arti's directories by default.
2021-11-21 11:52:43 -05:00
Nick Mathewson efdd327569 Rename .gitignore APP_FOO to ARTI_FOO.
Since these shell-variables are hardwired to use org.torproject.Arti as
the program name, it isn't appropriate to call them "app-specific".

If we someday reinstate APP_FOO, it should be based on a user-provided
application name.
2021-11-21 11:29:10 -05:00
Nick Mathewson 05be12e4d8 Give CfgPath an alternative inner representation.
In order to handle explicitly specified path buffers directly, we now
let CfgPath be either a string (that gets expanded) or a PathBuf
(that doesn't).

This simplifies TorClientConfig::with_directories()
2021-11-21 11:17:56 -05:00
Nick Mathewson 97f5a7a357 Give every ConfigBuilder a From<Config> implementation.
This will make it more convenient to reconfigure things.
2021-11-21 10:54:34 -05:00
Nick Mathewson aa83a5e38a Ensure that every section-level config type has a builder() function. 2021-11-21 10:54:34 -05:00
Nick Mathewson 0372d24eed Make arti-client config object match arti config better.
Now every section that the two configuration objects share has the
same type and name.  This should help us in documenting our configuration
in a way that doesn't confuse people.

There is still lots of API work to go.
2021-11-21 10:54:34 -05:00
Nick Mathewson 065d3dc104 Lower StorageConfig to arti-client crate 2021-11-21 10:54:34 -05:00
Nick Mathewson a7f5b9aefe Allow type-complexity in hyper.rs example
This isn't the prettiest, but suppressing the warning does make
the example warning free.
2021-11-21 10:53:06 -05:00
Nick Mathewson d592e86f9c Fold "circuit_timing" and "request_timing" into a single section. 2021-11-18 11:37:48 -05:00
Nick Mathewson 5184f5ba84 Move top-level configuration downwards from `arti` to `arti-config`.
To do this at all neatly, I had to split out `tor-config` from
`arti-config` again, and putting the lower level stuff (paths,
builder errors) into tor-config.  I also changed our use of
derive_builder to always use a common error type, to avoid
error type proliferation.
2021-11-18 11:37:48 -05:00
Nick Mathewson 15d1645bbd Typo fix from reddit thread. 2021-11-17 09:14:32 -05:00
Nick Mathewson e5c5519f7b Remove dependency from arti-client to tor-config.
I'm about to make tor-config a higher-level module, so it can't be a
dependency for tor-config.
2021-11-16 16:01:55 -05:00
Dimitris Apostolou ad3c18a456
Fix typos 2021-11-12 13:54:50 +02:00
Nick Mathewson 24b6a2455d Document that the "experimental-api" feature is not semver-covered. 2021-11-11 10:44:24 -05:00
Nick Mathewson 5287ac1858 Merge IpVersionPreferences and the optimistic flag into one type.
It seems like a good time to do this, before we add a zillion other
arguments to begin_stream.
2021-11-10 11:04:55 -05:00
Yuan Lyu 7f799c956b Implement optimistic stream 2021-11-09 21:36:12 -05:00
Nick Mathewson e6e740646a Bump all crate versions to 0.0.1 2021-10-29 11:05:51 -04:00
Nick Mathewson 9d3256ec83 Update README.md files 2021-10-29 09:37:15 -04:00
eta a12fffc66a Improve docs of more (potentially re-exported) arti-client types
Most of the structs in `arti-client` have example code now, to give a
clearer idea of how they're used.

Annoyingly, a lot of the types exposed in `arti-client` are actually
re-exports, which makes documentation a bit harder: example code that
references other parts of `arti-client` can't actually be run as a
doctest, since the crate it's in is a dependency of `arti-client`.

We might be able to fix this in future by doing the documentation in
`arti-client` itself, but rustdoc seems to have some weird behaviours
there that need to be investigated first (for example, it seems to merge
the re-export and original documentation, and also put the re-export
documentation on the `impl` block for some reason).

For now, though, this commit just writes the docs from the point of view
of an `arti-client` consumer, removing notes specific to the crate in
which they're defined. It's not ideal, but at least the end user
experience is decent.
2021-10-29 14:06:06 +01:00
Nick Mathewson c11fe200d1 Try writing a bit more documentation for configuration types. 2021-10-28 20:49:17 -04:00
Nick Mathewson 6cba1acef4 Encourage the use of TorClient::clone(). 2021-10-28 20:21:35 -04:00
Nick Mathewson bf3bfdf62d arti-client example: Try to make the comments a little more clear.
I'm not 100% sure this is better, but it might help the user
understand how Arti works a bit better.
2021-10-28 20:20:23 -04:00
Nick Mathewson 672335ccf6 Update README.md files 2021-10-28 19:59:22 -04:00
eta dcdd8c59df Improve top-level arti-client documentation, add example code
This overhauls the top-level `arti-client` documentation significantly:

- the "Using arti-client" section walks the user through all of the
  necessary steps to initiate a Torified TCP connection, and then
  provides a code example
  - this example is also available as `examples/readme.rs`; it's not run
    as a doctest, since it involves connecting to Tor
  - a "More advanced usage" subheading provides information about stream
    isolation (and can potentially be used for other interesting
    features once we get them).
- a new "Multiple runtime support" section was added to explain the
  purpose and usage of the `tor-rtcompat` crate
- the section on design and privacy considerations was removed; this is
  probably okay to keep in a README, but users of the crate aren't going
  to be interested in this (at least I don't think)

(also, the doc comment for `arti_client::Error` was fixed to make actual
sense)
2021-10-28 19:20:42 +01:00
Nick Mathewson 134c04a67a Update our disclaimers and limitations sections. 2021-10-27 11:13:46 -04:00
Nick Mathewson be4823818e TorClient::resolve_ptr should take an IpAddr. 2021-10-26 09:42:25 -04:00
Nick Mathewson 1b6098d00f More tests for arti_client::address 2021-10-26 09:32:41 -04:00
Nick Mathewson 47234655ce Turn StreamIsolation into a separate type.
Now that we have two kinds of isolation tokens (those set on a
stream, and those set by the stream's associated TorClient), we
need a more sophisticated kind of isolation.

This fixes the bug introduced with the previous commit, where
per-stream tokens would override per-TorClient tokens.
2021-10-25 12:32:18 -04:00
Nick Mathewson 16f6ee4b54 Add an isolate_client() function to create an isolated TorClient.
When two TorClients are isolated, their streams shouldn't share
circuits, even though they share internal circuit and guard state.
2021-10-25 12:02:44 -04:00
Nick Mathewson b477f12d83 s/arti-arti-client/arti-client/ and regenerate readme files 2021-10-25 08:40:00 -04:00
Nick Mathewson 89de07686d Upgrade to latest tracing-{subscriber,journald} 2021-10-23 22:23:26 -04:00
Nick Mathewson e00a1c59ae Run "cargo fix --edition-idioms=2018". 2021-10-22 09:05:45 -04:00
Nick Mathewson 7c7a388e28 Rename tor_client/arti_tor_client to arti_client.
Solves a name conflict with the existing tor_client create.

Closes #130.
2021-10-21 14:22:11 -04:00