Commit Graph

2235 Commits

Author SHA1 Message Date
Nick Mathewson bbf7c59b2d Describe when we will need SendmeAcceptMinVersion
(spoiler: not until we have a relay implementation)

Closes #53.
2022-01-12 15:52:24 -05:00
Nick Mathewson e335f6c75a Change RequireSendmeAuth to an enum.
This is a fine example of why booleans are risky:
it's far to easy to pass "animate:bool" into "inanimate:bool" like
we did here.

This is a followup from our fix to #294.
2022-01-12 15:46:36 -05:00
Nick Mathewson 1e915c3946 Fix a boolean inversion in auth_sendme_optional.
Previously we were requiring authenticated sendme cells exactly when we
should be permitting the old format, and vice versa.

This bug was caused by using a boolean to represent one property, but
with giving that boolean two different senses without inverting at the
right time.

The next commit will prevent a recurrence.

Closes #294
2022-01-12 15:36:55 -05:00
Nick Mathewson d49a490d4a Document SendmeEmitMinVersion status
(We don't need to look at SendmeEmitMinVersion since higher
values are not yet defined.)
2022-01-12 15:13:19 -05:00
Nick Mathewson e0ee3b5049 Explain that CfgPath can look at the environment.
Closes #246.
2022-01-12 14:59:13 -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
Ian Jackson cfcd3ea689 Add a blank line between doc and comment. 2022-01-11 18:23:58 +00:00
Nick Mathewson aee32b4beb Add the python script I use to generate changelog links. 2022-01-11 13:19:52 -05:00
Nick Mathewson 08d3ed978f Merge branch 'ticket_176_v2' into 'main'
guardmgr: Use a better persistent data format

Closes #176

See merge request tpo/core/arti!233
2022-01-11 17:52:00 +00:00
Nick Mathewson b89ce48490 Remove now-unused GuardSet::new(). 2022-01-11 12:00:09 -05:00
Nick Mathewson 70a2e2e751 guardmgr: Use a better persistent data format
Previously we stored only one guard sample, in a state file called
"default_guards".  That's not future-proof, since we want to have
multiple samples in the future.  (`guard-spec.txt` specifies
separate samples for highly restrictive filters, and for bridge
usage.)

This patch changes our behavior so that we can store multiple
samples in a new "guards" file.

I had thought about automatically migrating from the previous file
format and location, but I don't think that's necessary given our
current (lack of) stability guarantees.

Closes #176.
2022-01-11 12:00:09 -05:00
Nick Mathewson b9a83142f9 Merge branch 'ticket_276' into 'main'
guardmgr::..sample_test: Fix intermittent failure.

Closes #276

See merge request tpo/core/arti!234
2022-01-11 16:58:44 +00:00
Nick Mathewson f89b0bc752 guardmgr::..::sample_test: Fix intermittent failure.
This test should only fail very rarely (around 1/2.4e8) when guards
are chosen from a list of 20 with uniform probability.  But that
wasn't what we were doing on the mock test network: we were choosing
from a list of 10 viable guards, with nonuniform probability.

As a fix, we change the test network probabilities so that the
guards _are_ chosen with a uniform probability for this test, and we
use a modified version of the test network where there are indeed 20
Guard-flagged relays with the required DirCache=2 protocol.

Closes #276.
2022-01-11 11:35:16 -05: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 e735b3b208 CHANGELOG.md: spelling fix. (Thanks eta!) 2022-01-11 10:05:24 -05:00
Nick Mathewson 0003b706ba Release.md: Small fixes 2022-01-11 09:42:52 -05: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
Nick Mathewson 1b6b889c2c Run "cargo update". 2022-01-11 09:27:22 -05:00
Nick Mathewson e11871a134 Clear semver_status.md entries for 0.0.2 2022-01-11 09:25:53 -05:00
Nick Mathewson 343b8c3642 Draft changelog for 0.0.3. 2022-01-11 09:25:36 -05:00
Nick Mathewson cca29b46dc Check off some large items in README.md 2022-01-11 09:24:07 -05:00
Nick Mathewson 06ddb56541 Add more names to exclude_contributors.txt
(We don't put Tor Project employees in the acknowledgments lists.
And we probably shouldn't put bots either.)
2022-01-11 09:22:49 -05:00
Nick Mathewson f2e3e202ed Merge branch 'logfiles' 2022-01-10 13:24:49 -05:00
Ian Jackson 821091ae95 Apply suggestions to better describe the purpose of LogGuards. 2022-01-10 13:23:11 -05:00
Nick Mathewson 1a16f5a7d6 Tracing configuration for logfiles, per-target filters
Previously we could only configure one global tracing filter that
applied to stdout and journald.  There was no support for log files,
either.

This patch fixes both issues, by substantially revising the
configuration format: There are now separate filters for each log
file, for journald, and for the console log.  Because we want to
allow multiple logfiles, they have to go into an array in the
configuration.

The configuration logic has grown a bit complicated in its types,
since the tracing_subscriber crate would prefer to have the complete
structure of tracing Layers known statically. That's fine when you
know how many you have, and which kinds there will be, but for
the runtime-configuration case we need to mess around with
`Box<dyn Layer ...>`.

I also had to switch from tracing_subscriber's EnvFilter to its
Targets filter.  It seems "EnvFilter" can only be applied as a Layer
in itself, and won't work as a Filter on an individual Layer.

Closes #166.

Closes #170.
2022-01-10 13:23:11 -05:00
Nick Mathewson 736763fb51 Move tracing setup into a separate module.
No code changes here yet.
2022-01-10 13:17:02 -05:00
eta aa690a0c80 Merge branch 'eta/fix-doc-comment' into 'main'
Fixup broken doc comment from arti!220

See merge request tpo/core/arti!232
2022-01-10 16:47:06 +00:00
eta de1b19c22a Fixup broken doc comment from arti!220
That's what I get for blindly trusting @nickm :p
2022-01-10 15:10:41 +00: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
eta ebf05494fc Merge branch 'ticket_280' into 'main'
Make the arti_client::Result type public.

Closes #280

See merge request tpo/core/arti!230
2022-01-10 15:05:10 +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 da848a1b9c Merge branch 'ticket_178' into 'main'
Fix ticket 178: Don't use a NetDir until we have microdescriptors for all of our primary guards.

Closes #178

See merge request tpo/core/arti!220
2022-01-10 14:02:24 +00:00
eta 4b1a3976cb Merge branch 'bug274' into 'main'
Fix busy-loop when consensus is near expiring.

Closes #274

See merge request tpo/core/arti!223
2022-01-10 13:47:52 +00: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
Ian Jackson ce56a84093 Merge branch 'with_prefs' into 'main'
Use *_with_prefs() for Option<ConnectPrefs> callers in TorClient::connect

Closes #273

See merge request tpo/core/arti!229
2022-01-10 11:03:20 +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 c84c547bf4 Move our "minimal versions" code to a script.
Previously this code was in .gitlab-ci.yml, but for the purposes of
testing my fix for #275, it turned out to be much better to have it
in a script of its own.

Also, we now need to update our "quote" second-order dependency,
since otherwise our minimal first-order dependencies won't build
correctly.
2022-01-07 19:10:07 -05: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
Nick Mathewson e9a507af67 Merge branch 'circ_self_by_ref' 2022-01-07 14:48:21 -05:00
Nick Mathewson c123138f74 Merge branch 'remove-type-annotation' into 'main'
tor-circmgr: Remove a type annotation in a method call

See merge request tpo/core/arti!225
2022-01-07 19:33:04 +00:00
Nick Mathewson 0151ceceb0 ClientCirc: change some methods to take &self
Previously they took Arc<Self>, and then Self, but &self is perfectly
fine here.
2022-01-07 13:55:26 -05:00
Nick Mathewson debac8b973 circmgr: Fix a pair of clippy warnings. 2022-01-07 13:53:21 -05:00
Ian Jackson a82eaeacdc Merge branch 'dearcify_clientcirc_buildable' into 'main'
De-Arc-ify Buildable for ClientCirc

See merge request tpo/core/arti!219
2022-01-07 18:23:21 +00: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
Ian Jackson 14d7edc5f8 tor-circmgr: tests: Do fake circuit equality by id
We are going to get rid of the Arc.  Happily there is an id which is
always constructed uniquely and preserved by clone.

(auto-deref lets us make the function take &Self instead of &Arc)

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2022-01-07 18:16:43 +00:00
Ian Jackson 7c55141e3f tor-circmgr: tests: Introduce and use FakeCirc::eq()
This removes a lot of open-coded Arc::ptr_eq() calls

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2022-01-07 18:16:43 +00:00
Ian Jackson a034ef3526 tor-circmgr: Replace some Arc::clone with .clone()
This will make the code work when it's not an Arc any more.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2022-01-07 18:16:39 +00:00
Nick Mathewson d9b423c17f Fix busy-loop when consensus is near expiring.
When our current consensus is getting close to being invalid (but
it isn't invalid yet), we try to get a new one. So far, so good.

But we had a bug: when we went to get a new consensus, we'd see that we
had a perfectly fine not-yet-invalid consensus in our cache, reload it,
find that it was ready, and continue!

This patch fixes our behavior: If we have a usable consensus, then
when we reset the bootstrapping process, we ignore any cached consensus.

Fixes bug #274.
2022-01-07 13:16:06 -05:00