Commit Graph

1894 Commits

Author SHA1 Message Date
Nick Mathewson f399a7ecb5 Merge remote-tracking branch 'origin/mr/113' 2021-10-29 10:32:50 -04:00
Nick Mathewson a29378bf92 Add a list_crates.py script, for help with foreach scripting. 2021-10-29 10:32:16 -04:00
eta 71e87fc1ab Add an attempt at autogenerating contributor lists for releases
Disclaimer: I have no idea what I'm doing when it comes to shell
scripts.

maint/thanks.sh autogenerates a list of contributors since a revision
(that you pass it on the command line), intended to make the work of
going through the shortlog a bit less manual. It can exclude
contributors' names given in maint/exclude_contributors.txt, in order to
filter out people who work for Tor, or who commit under more than one
name.
2021-10-29 15:30:01 +01:00
Nick Mathewson e4716e71c0 Typo fix in Changelog 2021-10-29 10:27:22 -04:00
Nick Mathewson b90e83781d Add a script to enforce topological sorting in workspace Cargo.toml 2021-10-29 10:27:05 -04:00
Nick Mathewson f7a72d7f62 Update Cargo.lock in preparation for Arti 0.0.1 release. 2021-10-29 09:40:35 -04:00
Nick Mathewson 9d3256ec83 Update README.md files 2021-10-29 09:37:15 -04:00
Nick Mathewson 3dbf1eb637 Begin a CHANGELOG.md for Arti 0.0.1 2021-10-29 09:35:49 -04:00
Nick Mathewson 19a61249f8 Merge remote-tracking branch 'origin/mr/112' 2021-10-29 09:16:44 -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 1ee24ce653 Improve some documentation links
Instead of putting a fully qualified name in the text, in most cases
we should just use the short name of the type or function we're
referring to.

In other words, instead of saying [`crate::module::Foo`], we should
typically say [`Foo`](crate::module::Foo).
2021-10-29 08:39:04 -04:00
Nick Mathewson c11fe200d1 Try writing a bit more documentation for configuration types. 2021-10-28 20:49:17 -04:00
Nick Mathewson 2057142671 Use correct link for AsyncWriteExt::flush 2021-10-28 20:48:54 -04:00
Nick Mathewson 4107533d77 Typo fix in an expect() message. 2021-10-28 20:22:49 -04:00
Nick Mathewson 6cba1acef4 Encourage the use of TorClient::clone(). 2021-10-28 20:21:35 -04:00
Nick Mathewson c8f65e532e DataStream: document the importance of flush(). 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
Nick Mathewson 9304d5d6b7 Add removed paragraphs to Architecture.md 2021-10-28 19:59:05 -04:00
Nick Mathewson 19d3c34729 Merge remote-tracking branch 'origin/mr/111' 2021-10-28 19:54:03 -04:00
Nick Mathewson b160177b63 Oops: add missing data files 2021-10-28 19:51:16 -04:00
Nick Mathewson 4a721da54c tor-dirmgr: tests for GetMicrodescsState 2021-10-28 14:21:21 -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 2f149621fd tor-dirmgr: tests for download schedules. 2021-10-28 13:08:46 -04:00
Nick Mathewson e6c0fbaa10 tor-chanmgr: remove PendingChanError as unnecessary. 2021-10-28 12:41:08 -04:00
Nick Mathewson dcc1acb2fc Merge branch 'test_dirmgr' 2021-10-28 11:56:41 -04:00
Nick Mathewson a730478fd0 Fix clippy warnings in tests. 2021-10-28 11:44:09 -04:00
Nick Mathewson 6dde31f328 Merge remote-tracking branch 'origin/mr/110' 2021-10-28 11:40:18 -04:00
Nick Mathewson 0979e60293 Mark request_retried test as ignored 2021-10-28 11:30:16 -04:00
Trinity Pointard 0438a3da93 move integration tests to scripts 2021-10-28 11:28:22 -04:00
Nick Mathewson 7e8891b861 tor-dirmgr: Test for GetCertsState 2021-10-28 10:21:56 -04:00
Nick Mathewson 8956e6cd8b tor-dirmgr: Tests for GetConsensusState.
This test uses a consensus that I've copied from
tor-netdoc/testdata.  I would include it directly, but I think that
will cause trouble when it comes time to run "cargo package".
2021-10-28 09:35:18 -04:00
Nick Mathewson 5e27c46d24 tor-dirmgr::state: Mock the view of current time.
This will let us test the state processing code without having to
give it up-to-date directory objects.
2021-10-28 08:41:59 -04:00
Nick Mathewson b7c7c8ba13 tor_circmgr: Refactor and re-enable build_timeout() test
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?
2021-10-27 16:31:31 -04:00
Nick Mathewson 3c82666d39 Small FAQ update. 2021-10-27 15:07:49 -04:00
Nick Mathewson 01894dcd68 Add missing entries to Architecture.md 2021-10-27 15:05:00 -04:00
Nick Mathewson 2fae63b5ae Upgrade to fslock version 0.2
This version makes all locks per-handle rather than per-process, by
moving from lockf() to flock() on unix.
2021-10-27 14:52:09 -04:00
eta 4fa0122dde Improve and future-proof the `arti` CLI
This switches out `arti`'s argument-parsing library with `clap`, which
is a lot more featureful (and very widely used within the Rust
ecosystem). We also now use a lot of `clap`'s features to improve the
CLI experience:

- The CLI now expects a subcommand (currently, either "help", or "proxy"
  for the existing SOCKS proxy behaviour). This should let us add
  additional non-SOCKS-proxy features to arti in future.
- `clap` supports default values determined at runtime, so the way the
  default config file is loaded was changed: now, we determine the
  OS-specific path for said file before invoking `clap`, so the help
  command can show it properly.
  - The behaviour of `tor_config` was also changed; now, one simply
    specifies a list of configuration files to load, together with
    whether they're required.
  - That function also way overused generics; this has been fixed.
- Instead of using the ARTI_LOG environment variable to configure
  logging, one now uses the `-l, --log-level` CLI option.
  (The intent is for this option to be more discoverable by users.)
- The `proxy` subcommand allows the user to override the SOCKS port used
  on the CLI without editing the config file.
2021-10-27 19:11:48 +01:00
Nick Mathewson 134c04a67a Update our disclaimers and limitations sections. 2021-10-27 11:13:46 -04:00
eta 5a4db67b16 Add Futureproof<T> wrapper type, use for GuardDisabled enum
The Futureproof<T> type lets you serialize and deserialize types whose
representations might change (most useful for enums that might grow
additional variants). It uses #[serde(untagged)] to accomplish this.

This gets used in order to make the `disabled` field of `Guard` more
robust against future guard disablement reasons being added.

A test was also added to verify correct behaviour of the new type.
2021-10-27 15:10:44 +01:00
eta 7a931b4de3 Add #[serde(flatten)] HashMap fields to serializable objects
As per arti#175, we'd like to be able to handle newer Arti versions
storing additional state in the persisted state files, without dropping
this data on the floor when we write out changes to these files.

Use the #[serde(flatten)] mechanism to achieve this, by adding catch-all
HashMap<String, JsonValue> fields to all structs that are at risk of
this happening to them.
2021-10-27 13:31:52 +01:00
Nick Mathewson e64177d97e Fix some clippy-nightly warnings.
These are my fault; I merged the wrong version of !102. :p
2021-10-26 13:13:46 -04:00
Nick Mathewson 9a10d4ae50 Clarify that new SleepProvider methods are testing-only. 2021-10-26 13:06:10 -04:00
Nick Mathewson c6a1bcaa69 circmgr: Split request_timeout test into two.
There seems to be some issue here with the new WaitFor code,
where using the same MockSleepProvider with both of these wait_for()
calls gives questionable behavior under some circumstances (like
when running under Tarpaulin with the wrong set of flags).
2021-10-26 13:01:13 -04:00
Nick Mathewson b0fd7cff8e Merge remote-tracking branch 'origin/mr/102' 2021-10-26 13:01:01 -04:00
Nick Mathewson da45008644 Merge branch 'pb_lite_squashed' 2021-10-26 12:03:51 -04:00
Nick Mathewson 682f31b1bf Avoid a strange borrow syntax in tor_guardmgr::sample
I'm not sure what I was thinking here.
2021-10-26 12:03:23 -04:00
Nick Mathewson 72ebaed16b Do not blame a guard for failures on non-random circuits.
We must not apply our new path-bias behavior (where we blame a guard
if it gives us too many indeterminate circuit failures) if the path
was not chosen at random.  If too many random paths fail, we know
that's suspicious, since the other relays are a random sample.  But
if a bunch of user-provided paths fail, that could simply be because
the user's chosen exit is down.
2021-10-26 12:03:23 -04:00
Nick Mathewson 8c69b5d389 Implement a "lightweight" form of pathbias detection.
We now track, for every guard: the total number of successful
circuits we've built through it, along with the total number of
"indeterminate" circuits.

Recall that a circuit's status is "indeterminate" if it has failed
for a reason that _might_ be the guard's fault, or might not be the
guard's fault.  For example, if extending to the second hop of the
circuit fails, we have no way to know whether the guard deliberately
refused to connect there, or whether the second hop is just offline.

But we don't want to forgive all indeterminate circuit failures: if
we did, then a malicious guard could simply reject any second hops
that it didn't like, thereby filtering the client into a chosen
set of circuits.

As a stopgap solution, this patch now makes guards become
permanently disabled if the fraction of their circuit failures
becomes too high.

See also general-purpose path bias selection (arti#65), and Mike's
idea for changing the guard reachability definition (torspec#67).
This patch doesn't do either of those.

Closes #185.
2021-10-26 12:03:23 -04:00
eta e8419abd25 Overhaul the way WaitFor and the MockSleepProvider work
Instead of racily advancing time forward, this commit attempts to rework
how WaitFor works, such that it makes advances when all sleeper futures
that have been created have been polled (by handing the MockSleepRuntime
a Waker with which to wake up the WaitFor).

The above described mechanics work well enough for the double timeout
test, but fail in the presence of code that spawns asynchronous /
background tasks that must make progress before time is advanced for the
test to work properly. In order to deal with these cases, a set of APIs
are introduced in order to block time from being advanced until some
code has run, and a carveout added in order to permit small advances in
time where required.

(In some cases, code needed to be hacked up a bit in order to be made
properly testable using these APIs; the `MockablePlan` trait included in
here is somewhat unfortunate.)

This should fix arti#149.
2021-10-26 16:33:23 +01:00