Commit Graph

363 Commits

Author SHA1 Message Date
Ian Jackson b5218a0c0e channel padding: Introduce ChannelsConfig and reconfigure facility
Nothing geenrates config updates yet.
2022-06-21 19:19:22 +01:00
Ian Jackson 09b40d7d81 channel padding timer: Support reconfiguration
Nothing calls this yet.
2022-06-21 19:19:22 +01:00
Ian Jackson e5f3215b95 channel padding timer: Allow creation without providing parameters yet
It turns out that we are going to want this.
2022-06-21 19:19:22 +01:00
Ian Jackson f9414a29b2 channel padding: Test creation in disabled state
We're about to split the main new() function off so write a separate
test for new_disabled().
2022-06-21 19:19:22 +01:00
Ian Jackson 7135b7c4c7 channel padding: Make Parameters a pub struct with builder
chanmgr is going to want to make one of these from a NetDir.
2022-06-21 19:19:22 +01:00
Nick Mathewson 08d9bbf33b Do not include error source() in display() format.
According to doc/Errors.md, and in keeping with current best
practices, we should not include display an error's `source()` as
part of that error's display method.  Instead, we should let the
caller decide to call source() and display that error in turn.

Part of #323.
2022-06-21 14:14:14 -04:00
Nick Mathewson 5509bd0269 Merge branch 'config-fix2' into 'main'
Use impl_standard_builder more and remove manual Default/builder impls

See merge request tpo/core/arti!594
2022-06-16 20:30:34 +00:00
Ian Jackson 44659ebb8b tor-proto: channel: Tell clippy it's ok to print in tests 2022-06-16 19:33:32 +01:00
Nick Mathewson 0223c91b26 Merge branch 'high-level-features' into 'main'
Add "full" and "experimental" features to arti, arti-client, and below.

Closes #499

See merge request tpo/core/arti!584
2022-06-16 12:24:47 +00:00
Nick Mathewson 2f0bef64a3 Permit eprintln in channel-padding test.
There is not, apparently, an eprintln equivalent for
allow-dbg-in-tests.
2022-06-15 11:52:30 -04:00
Nick Mathewson 8a586a40fa Add "full" and "experimental" features to arti-client and below.
The "full" feature is a catch-all for all features, _except_:

   * Those that select a particular implementation (like
     tor-llcrypto/with-openssl) or build flag (like "static")
   * Those that are experimental or unstable (like "experimental-api")
   * Those that are testing-only.
2022-06-10 15:32:21 -04:00
Nick Mathewson 4f6c4f91c9 Merge branch 'channel' into 'main'
Have channel reactor able to send channel padding

See merge request tpo/core/arti!574
2022-06-10 13:28:51 +00:00
Ian Jackson 1c6ca6d286 channel padding timer: Explain why next() in select_biased! 2022-06-09 16:56:33 +01:00
Ian Jackson 9c92022663 channel padding timer: document state invariants
There aren't very many.
2022-06-09 16:31:11 +01:00
Ian Jackson be04c05cce Fix more typos in comments, from a spellchecker 2022-06-09 16:31:08 +01:00
Nick Mathewson b9db07fea9 Fix typo in comment 2022-06-09 15:01:56 +00:00
Nick Mathewson 1adc65ab53 Fix erroneous comment 2022-06-09 14:58:30 +00:00
Nick Mathewson 5815e14b94 Fix typos in comments 2022-06-09 14:58:17 +00:00
Ian Jackson 3f2e164bc5 tor-proto: padding: Test padding timer distribution 2022-06-08 16:04:58 +01:00
Ian Jackson bbcdf9dd8b tor-proto: channel: Use padding::Timer 2022-06-08 16:04:58 +01:00
Ian Jackson 0027b2371f tor-proto: channel: Provide padding::Timer 2022-06-08 16:04:58 +01:00
Ian Jackson af92d72b39 Change to exhaustive match. 2022-06-08 16:02:22 +01:00
trinity-1686a e3c9152977 update semver.md 2022-06-08 16:02:22 +01:00
trinity-1686a 6c6998a65b try to differentiate transient from nontransient error 2022-06-08 16:02:01 +01:00
Ian Jackson d202c3e9ca Merge branch 'sleep' into 'main'
Plumb a SleepProvider (now Clone + ....) into Channel

See merge request tpo/core/arti!569
2022-06-08 10:46:37 +00:00
Ian Jackson 8eb215bf81 Document semver changes 2022-06-08 11:24:26 +01:00
Ian Jackson e8fc1036d3 Plumb a SleepProvider into the channel reactor
The channel reactor is going to want to be able to sleep so that it
can do padding, so it needs a SleepProvider.
2022-06-08 11:24:26 +01:00
Nick Mathewson 5854e4bbd9 Merge branch 'use-testing-rng' 2022-06-07 19:02:12 -04:00
Nick Mathewson 967ea67b7d Use testing_rng() in tests throughout our crates.
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.
2022-06-02 14:56:42 -04:00
Ian Jackson 98ccd7e7e2 Merge branch 'lint' into 'main'
lints: Make lint blocks consistent and ensure they stay that way

Closes #469

See merge request tpo/core/arti!557
2022-05-31 18:27:53 +00:00
David Goulet 710709313b proto: Only ready a DataStream if CONNECTED was succesfully received
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-05-31 12:20:18 -04:00
Ian Jackson ba0843da4a lints: Add lint block delimiters to every crate
This was the result of:
  maint/add_warning crates/*/src/{lib,main}.rs
and then manually curating the results.
2022-05-31 13:00:31 +01:00
Orhun Parmaksız bfd41ddb5f
Lexically sort Cargo.toml dependencies
Utilize cargo-sort: https://github.com/DevinR528/cargo-sort

Signed-off-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
2022-05-28 20:05:51 +03:00
Nick Mathewson 4326aa1de9 Regenerate version bump from previous commit.
This commit was made by reverting the previous commit, then
re-running the script I used to generate it.  In theory there should
be no semantic changes: only changes due to improved formatting from
cargo edit.
2022-05-27 10:18:52 -04:00
Nick Mathewson b232365a75 Semantic version changes for Arti 0.4.0 release
I followed the following procedure to make these changes:

* I used maint/changed_crates to find out which crates had changed
  since 0.3.0.
* I used grep and maint/list_crates to sort those crates in
  topological (dependency) order.
* I looked through semver_status to find which crates were listed as
  having semver-relevant changes (new APIs and breaking changes).
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no changes.  For those crates, I incremented their patch-level
  version _without_ changing the version that other crates depend on.
* I scanned through the git logs of the crates with no
  semver-relevant changes listed to confirm that, indeed, they had
  no obvious breaking changes.
* I treated all crates that depend on `arti` and/or `arti-client` as
  having breaking changes.
* I identified crates that depend on crates that have changed, even
  if they have not changed themselves, and identified them as having
  a non-breaking change.
* For all of the crates, I used `cargo set-version -p $CRATE --bump
  $STATUS` (where `STATUS` is `patch` or `minor`) to update the
  versions, and the depended-upon versions.
2022-05-27 09:01:20 -04:00
Nick Mathewson bbc7470dc5 More tests for ClockSkew. 2022-05-25 15:57:19 -04:00
Ian Jackson 2fc6c8a194 prepare_send_from: clippy: Replace some or_else with or 2022-05-23 11:28:05 +01:00
Ian Jackson 793782acc8 channel: Provide and use Sink::prepare_send_from
This is a general-purpose implementation of the ad-hoc approach
currently taken in (eg) crates/tor-proto/src/channel/reactor.rs,
with an API intended to defned against the more obvious mistakes.

This allows us to separate the two concerns: the channel reactor can
focus on handling channel cells and control messages and is over 2.5x
shorter.

The complexity of the manual sink implementation, and the machinery
needed to avoid having to suspend while holding an item, are dealt
with separately.  That separate implemenation now has proper
documentation.  (Tests are in the nest commit to avoid this one being
even more unwieldy.)

We use `extend` to define this as an extension trait.  A competitor is
`ext` but in my personal projects I have found `extend` slightly
better.
2022-05-23 11:28:05 +01:00
Nick Mathewson fb432924a3 Merge branch 'main' into 'ticket_466'
# Conflicts:
#   doc/semver_status.md
2022-05-16 15:10:00 +00:00
Ian Jackson 0cc94d449e clippy: Change a binding to (), and allow clippy::let_unit_value
The type of ret.map_err(codec_err_to_chan)? is ().  ISTM that
writing `let () = ` makes it clear that there is nothing there,
but the lint forbids this.

This lint is warn by default and trips here for me on current nightly.

It seems wrong to me.  We should be able to make it clear to the
reader that there is nothing here - note how this differs from the
lines below where Ready contains msg.  A let () binding is a good way
to do that.

I think the lint allow ought to be added everywhere, but that doesn't
seem easy right now - see this issue about maint/add_warning:
   https://gitlab.torproject.org/tpo/core/arti/-/issues/469
2022-05-11 18:52:12 +01:00
Nick Mathewson 0c05baa68b Add a channel accessor to ClientCirc.
I need this so that I can expose the skew time for the directory
that a circuit will use, when I only have the circuit.
2022-05-11 13:02:36 -04:00
Nick Mathewson 7b93091f57 Bump the version of every* crate to 0.3.0
* Except for safelog and fs-mistrust, which are new.
2022-05-06 10:03:15 -04:00
Nick Mathewson fc33fc3efb Fix typos (using the typos-cli tool). 2022-05-04 14:41:50 -04:00
Nick Mathewson aaab6f3812 Upgrade to AES 0.8
Now that we require Rust 1.56, we can upgrade to AES 0.8.  This
forces us to have some slight API changes.

We require cipher 0.4.1, not cipher 0.4.0, since 0.4.0 has
compatibility issues with Rust 1.56.
2022-04-26 12:16:22 -04:00
Nick Mathewson 2f6bc6bdc4 squash! Bump every crate's edition to 2021.
Remove all `use` statements for `TryFrom` and `TryInto`.  These are
now redundant in Rust 2021.
2022-04-25 13:06:26 -04:00
Nick Mathewson b60b0a266a Bump every crate's edition to 2021.
This is an automated change made with a perl one-liner and verified
with grep -L and grep -l.

Some warnings are introduced with this change; they will be removed
in subsequent commits.

See arti#208 for older discussion on this issue.
2022-04-25 13:05:31 -04:00
Nick Mathewson ca05b0904c Add 'rust-version = "1.56"' to every Cargo.toml file.
This change was made automatically with a perl one-liner, and
confirmed with `grep -L`.

The `rust-version` field itself was introduced in 1.56.0.
2022-04-25 13:04:31 -04:00
Nick Mathewson 0069fd2206 Reformat all not-yet-reformatted Cargo.toml files.
There are no semantic changes here; only formatting.  This is in
preparation for other changes (wrt MSRV and edition)
2022-04-25 13:04:31 -04:00
Nick Mathewson 4efe45ce6e handshake.rs: Document the time for clock skew authentication. 2022-04-11 12:34:16 -04:00
Nick Mathewson cf362fac9f Implement a better clock skew estimator.
This time, our estimator discards outliers, takes the mean of what's
left, and uses the standard deviation to try to figure out how
seriously to take our report of skew/not-skew.

These estimates are still not actually used.
2022-04-11 12:34:16 -04:00
Nick Mathewson eedee51899 Initial functions to determine and expose a clock skew estimate.
(This is just a placeholder; I'm going to make the functions
smarter in the next commit.)
2022-04-07 16:01:46 -04:00
Nick Mathewson 9160b55c57 chanmgr: bubble ClockSkew up through the Error object.
Fortunately, we don't need a separate type here: authenticated
clock skew can only come attached to a `tor_proto::Error`.

We also remove skew from `tor_proto::Error::HandshakeCertsExpired`,
since it would now be redundant.
2022-04-07 10:15:28 -04:00
Nick Mathewson 7656ab0931 Channel: Expose our view of whether the clock is skewed, and the age
of a channel.

At first I wanted to have this information not be a part of channels
at all, but it is a fairly tiny amount of data, and the alternatives
are pretty crufty.
2022-04-07 10:07:35 -04:00
Nick Mathewson 5b2fc118df Bump all arti*, tor* crates to 0.2.0
Not all of these strictly need to be bumped to 0.2.0; many could go
to 0.1.1 instead.  But since everything at the tor-rtcompat and
higher layers has had breaking API changes, it seems not so useful
to distinguish.  (It seems unlikely that anybody at this stage is
depending on e.g. tor-protover but not arti-client.)
2022-04-01 09:15:18 -04:00
Nick Mathewson 791394cd2b Merge branch 'netinfo-clock-skew' into 'main'
tor-proto: add the ability to learn clock skew from NETINFO cells

See merge request tpo/core/arti!410
2022-03-23 12:49:36 +00:00
Nick Mathewson 0b2cf533ee tor-proto: better errors when handshake fails due to untimely certs
We now check the handshake certificates unconditionally, and only
report them as _expired_ as a last resort.

(Rationale: if somebody is presenting the wrong identity from a year
ago, it is more interesting that they are presenting the wrong ID
than it is that they are doing so with an expired cert.

We also now report a different error if the certificate is expired,
but its expiration is within the range of reported clock skew.

(Rationale: it's helpful to distinguish this case, so that we can
blame the failure on possible clock skew rather than definitely
attributing it to a misbehaving relay.)

Part of #405.
2022-03-23 08:24:36 -04:00
Nick Mathewson 3885a2c05b tor-proto: add a backend to detect reported clock skew.
NETINFO cells, which are sent in every handshake, may contain
timestamps.  This patch adds an accessor for the timestamp in the
Netinfo messages, and teaches the tor-proto code how to compute the
minimum clock skew in the code.

The computation isn't terribly precise, but it doesn't need to be:
Tor should work fine if your clock is accurate to within a few
hours.

This patch also notes a Y2038 problem in the protocol: see
torspec#80.

Part of #405.
2022-03-23 08:24:36 -04:00
Nick Mathewson d39557b851 Define accessors for circuit hops.
Closes #415
2022-03-17 12:36:57 -04:00
Nick Mathewson 764930b9cd tor-proto: Remember peer information in circuit and channel
Each channel now remembers an OwnedChanTarget.

Each circuit now remembers a vector of OwnedChanTarget to represent
the path that it was constructed for.

Part of #415.
2022-03-17 12:03:34 -04:00
Nick Mathewson 567995a7ca ClientCirc: Move n_hops into a new Path type.
This will help with #415
2022-03-17 10:34:06 -04:00
Ian Jackson b095265257 Merge branch 'educe-traits' into 'main'
Replace many manual trait impls with use of educe

See merge request tpo/core/arti!375
2022-03-04 18:00:17 +00:00
Ian Jackson ebfd734956 Move skip_fmt into tor-basic-utils
Code motion and the minimal mechanical changes.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
2022-03-04 11:45:24 +00:00
Ian Jackson 9dca756e23 Replace manual Debug impls with educe in tor-proto
We now print slighly more information.
2022-03-02 18:06:37 +00:00
Ian Jackson 89074a1326 Replace manual Default and new with std derive in tor-proto 2022-03-02 18:01:08 +00:00
Nick Mathewson 83c8b11c2c Merge branch 'clippy-allow-arc-clone' into 'main'
Disable clippy::clone_on_ref_ptr

See merge request tpo/core/arti!352
2022-03-01 20:38:05 +00:00
Nick Mathewson e8e9791a97 Bump all crates to 0.1.0 2022-03-01 08:59:34 -05:00
trinity-1686a 55a1433499 remove usage of dbg!(..)
it's making rust-nightly job fail
2022-02-28 18:20:34 +01:00
eta 1276f71e9a Merge branch 'always-coarsetime' into 'main'
Make coarsetime dependency and traffic-timestamping non-optional.

See merge request tpo/core/arti!358
2022-02-28 13:39:10 +00:00
Nick Mathewson 6755648f6b Merge branch 'upgrade-dependencies' into 'main'
Upgrade a few dependencies to newer versions

See merge request tpo/core/arti!357
2022-02-25 16:30:00 +00:00
Nick Mathewson 4becaa01b9 Bump minimum tokio to 1.7, since tokio-util now needs that. 2022-02-25 11:09:24 -05:00
Nick Mathewson 3d7d609922 Make coarsetime dependency and traffic-timestamping non-optional.
Previously coarsetime and the traffic-timestamp feature were
enabled, since they were only required for a small corner of the
guardmgr algorithm.

But in 1.0 and beyond we'll be adding a bunch of other features (eg,
netflow padding, DoS prevention) that will need coarsetime all over
the place.

And since we're going to be doing coarsetime all over the place, the
previous justification for making traffic-timestamping optional (the
tiny performance hit) is no longer relevant.
2022-02-25 10:31:01 -05:00
Nick Mathewson 55416937cc Upgrade dependency to new version of tokio-util. 2022-02-25 08:48:00 -05:00
Ian Jackson 3903900461 tor-proto datastream: Fix typo in Debug impl
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/353#note_2781632
2022-02-25 12:23:49 +00:00
eta 3e37d7e105 Merge branch 'debug-datastream' into 'main'
tor-proto datastream: Do not dump packet data in DataWriterImpl

See merge request tpo/core/arti!353
2022-02-24 21:30:52 +00:00
Ian Jackson 78ab634ed9 Fix rustfmt 2022-02-24 19:45:58 +00:00
Nick Mathewson 7f3ea03e58 Merge branch 'proto_handshake_err' into 'main'
tor-proto: Split up a couple of handshake-based errors

Closes #359 and #358

See merge request tpo/core/arti!344
2022-02-24 19:44:34 +00:00
Ian Jackson f3520478b1 tor-proto datastream: Do not dump packet data in DataWriterImpl 2022-02-24 19:39:18 +00:00
Ian Jackson 097c852e58 tor-proto datastream: import std::fmt::Debug trait name 2022-02-24 19:39:18 +00:00
eta 3e4358c5d3 Merge branch 'remote_stream_err' into 'main'
Give specific error kinds to different END reasons

Closes #360

See merge request tpo/core/arti!343
2022-02-24 19:31:41 +00:00
eta b5cd85b401 Merge branch 'debug-datastream' into 'main'
impl Debug for DataStream (and its components)

See merge request tpo/core/arti!351
2022-02-24 18:36:19 +00:00
Nick Mathewson d8120e1649 proto: Refactor conversion from CodecError to Error
Remove default conversion; instead use a specific conversion in each
of the two modules that need to do it.
2022-02-24 13:23:42 -05:00
Ian Jackson afb50fe735 Disable clippy::clone_on_ref_ptr
This lint is IMO inherently ill-conceived.

I have looked for the reasons why this might be thought to be a good
idea and there were basically two (and they are sort of contradictory):

I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact
    that only the pointer is being cloned, not the underlying data."

This is the wording from
  https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr

It is a bit terse; we are left to infer why it is a bad idea to
obscure this fact.  It seems to me that if it is bad to obscure some
fact, that must be because the fact is a hazard.  But why would it be
a hazard to not copy the underlying data ?

In other languages, faliing to copy the underlying data is a serious
correctness hazard.  There is a whose class of bugs where things were
not copied, and then mutated and/or reused in multiple places in ways
that were not what the programmer intended.  In my experience, this is
a very common bug when writing Python and Javascript.  I'm told it's
common in golang too.

But in Rust this bug is much much harder to write.  The data inside an
Arc is immutable.  To have this bug you'd have use interior mutability
- ie mess around with Mutex or RefCell.  That provides a good barrier
to these kind of accidents.

II. "The reason for writing Rc::clone and Arc::clone [is] to make it
     clear that only the pointer is being cloned, as opposed to the
     underlying data. The former is always fast, while the latter can
     be very expensive depending on what is being cloned."

This is the reasoning found here
  https://github.com/rust-lang/rust-clippy/issues/2048

This is saying that *not* using Arc::clone is hazardous.
Specifically, that a deep clone is a performance hazard.

But for this argument, the lint is precisely backwards.  It's linting
the "good" case and asking for it to be written in a more explicit
way; while the supposedly bad case can be written conveniently.

Also, many objects (in our codebase, and in all the libraries we use)
that are Clone are in fact simply handles.  They contain Arc(s) (or
similar) and are cheap to clone.  Indeed, that is the usual case.

It does not make sense to distinguish in the syntax we use to clone
such a handle, whether the handle is a transparent Arc, or an opaque
struct containing one or more other handles.

Forcing Arc::clone to be written as such makes for code churn when a
type is changed from Arc<Something> to Something: Clone, or vice
versa.
2022-02-24 18:15:44 +00:00
Ian Jackson b56115a04f impl Debug for DataStream (and its components)
My proximate motivation is that tls-api wants its inner streams to be
Debug.  But in general, I agree with the Rust API Guidelines notion
that almost everything should be Debug.

I have gone for the "dump all the things" approach.  A more nuanced
approach would be possible too.
2022-02-24 17:49:34 +00:00
Nick Mathewson 74a5ce8635 tor-proto: refactor handshake protocol errors to a different type
This helps the user distinguish between protocol violations that
happen when connecting to the tor network from those that happen
while connected.

Closes #358.
2022-02-23 10:39:08 -05:00
Nick Mathewson d42b932ed9 tor-proto: Rename BadHandshake to BadCircHandshake
(We'll have a BadChanHandshake soon.)
2022-02-23 10:39:08 -05:00
Nick Mathewson afa49eac8f tor-proto: Split IoErr based on when it occurs
We want to distinguish handshake failures from errors later on in
the channel's lifetime.

Closes #359.
2022-02-23 10:38:48 -05:00
Nick Mathewson 6c615898e4 Give specific error kinds to different END reasons
Closes #360.
2022-02-23 09:35:28 -05:00
Nick Mathewson 92141c6d72 Merge remote-tracking branch 'origin/mr/340' 2022-02-23 09:29:40 -05:00
Nick Mathewson a2e2663e90 Eliminate RequestedResourceAbsent kind.
There was only one use of this, and it was in as-yet-unused relay-only
code.

Removing this type required refactoring the relay onion handshake code
to use its own error type, which is probably clever anyway.
2022-02-22 16:00:25 -05:00
Nick Mathewson 789e6c87b8 Fold NamespaceFull into BadApiUsage. 2022-02-22 15:44:49 -05:00
Nick Mathewson 4cedc1a190 Rename RemoteNameError to RemoteHostNotFound
This is a bit ugly but we need it to work around the problem where
exits aren't always clear about _why_ a hostname lookup failed.
2022-02-22 15:43:27 -05:00
Nick Mathewson 0d079071fe Replace RemoteRefused with CircuitRefused.
Also document that it's a lower-level error kind.
2022-02-22 15:34:46 -05:00
Nick Mathewson f018d0c74b Rename RemoteIdMismatch to RelayIdMismatch. 2022-02-22 15:32:08 -05:00
Nick Mathewson 5351aaa308 Fold AlreadyClosed into BadApiUsage 2022-02-22 15:25:24 -05:00
Nick Mathewson dd55f5ce2d Remove clippy::needless_borrow exception in CI.
This exception is no longer necessary now that the underlying CI bug
is fixed.
2022-02-20 09:09:38 -05:00
Yuan Lyu 7ab840785e Replace as_mut with deref impl for MutCircEnt 2022-02-16 17:23:16 -05:00
Yuan Lyu cc7023fb75 Make CircMap open_ent_count O(1) 2022-02-16 16:48:49 -05:00
Nick Mathewson 62a62b6dfd tor_proto::Error: Fix an incomplete sentence. 2022-02-16 11:09:59 -05:00
Nick Mathewson 6b611d6dea Update tor-proto errors to latest API. 2022-02-15 09:57:03 -05:00
Nick Mathewson 4af279b173 Make tor-proto::Error implement HasKind.
This took some refactoring, and gave an opportunity to notice
a few error variants that weren't being used, or didn't mean
what they said on the tin.
2022-02-15 09:41:47 -05:00
Nick Mathewson f23f375e42 tor-proto: use InternalError for internal errors. 2022-02-15 09:41:11 -05:00
Nick Mathewson da0e9e456c tor-cell: provide HasKind.
Additionally, refactor the IoError out of tor_cell::Error:
nothing in TorCell created this; it was only used by tor_proto.

This required refactoring in tor_proto to use a new error type. Here I
decided to use a new CodecError for now, though we may refactor that
away soon too.
2022-02-15 09:41:10 -05:00
eta 29daf5a74a Merge branch 'warn_not_deny' into 'main'
Change deny(clippy::all) to warn(clippy::all).

Closes #338

See merge request tpo/core/arti!306
2022-02-14 19:45:18 +00:00
Nick Mathewson 1cecc7e45a Change deny(clippy::all) to warn(clippy::all).
Closes #338.
2022-02-14 09:24:06 -05:00
Nick Mathewson dc9f1afeb3 Use atomic set-and-check to update OptTimestamps if none.
This fixes a tiny race condition in the previous code, where we
checked whether an OptTimestamp is None a bit before we set it.
Since std::atomic gives us compare_exchange, we might as well use
it.
2022-02-09 10:24:31 -05:00
Yuan Lyu 595fe1ab88 Remove the use of Mutex in channel unused_since timestamp 2022-02-08 18:28:45 -05:00
Yuan Lyu f6f732a478 Expire channels that have been unused for too long 2022-02-04 22:52:51 -05:00
eta e9087e1fed Merge branch 'eta/reactor-2.5' into 'main'
Fix severe reactor ordering problems

See merge request tpo/core/arti!282
2022-02-03 16:27:57 +00:00
Nick Mathewson 03755a5c7b Merge branch 'dirclient-testing' into 'main'
dir-client: bug fix and more tests

See merge request tpo/core/arti!271
2022-02-03 15:09:06 +00:00
eta 24d12163f2 Fix severe reactor ordering problems
A number of severe problems with the circuit reactor were fixed which
could cause reordering of cells (which causes relays to terminate the
circuit with a protocol violation, as they become unable to decrypt
them). These mostly revolve around improper usage of queues:

- The code assumed that a failure to place cells onto the channel would
  persist for the duration of a reactor cycle run. However, under high
  contention, this wouldn't always be the case.
  - This leads to some cells getting enqueued while others go straight
    through, before the enqueued cells.
  - To fix this, we block sending cells out of the channel while there
    are still some enqueued.
- The hop-specific queues queued after encryption, not before. This was
  very brittle, and led to frequent mis-ordering.
  - This was fixed by making them not do that.

This is arti!264 / 5bce9db562 without the
refactor part.
2022-02-03 15:04:28 +00:00
eta cc37c8f5b5 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!285
2022-02-03 13:12:38 +00:00
Ian Jackson 7be3bf6339 Temporarily disable some clippy lints on nightly 2022-02-02 21:57:30 +00:00
Ian Jackson b7fec1c8a4 Remove many needless borrows and slices
Found via clippy::needless_borrow.  In some cases I removed needless
`[..]` too.  See also:
  needless_borrow suggestion doesn't go far enough
  https://github.com/rust-lang/rust-clippy/issues/8389
2022-02-02 18:34:26 +00:00
Dimitris Apostolou 6526321851
Fix typos 2022-02-02 20:18:22 +02:00
Nick Mathewson c8dd73d55f Upgrade required version of futures crate to 0.3.14
Earlier versions have a bug in UnboundedReceiver that make our new
dirclient tests fail.
2022-02-01 09:54:47 -05:00
Nick Mathewson 01d9937308 Bump the patch version of every crate that changed since 0.0.3 2022-01-31 10:30:52 -05:00
Nick Mathewson 5187b05c19 Use script to update README.md files. 2022-01-28 08:36:34 -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 884d614a61 Remove a now-incorrect comment in tor-proto. 2022-01-26 14:06:58 -05:00
Ian Jackson 9a77b23cdd clippy: Rename a `decode_chanmsg` from `handle_`
As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/249#note_2771025

It doens't really handle it.
2022-01-19 18:46:13 +00:00
Ian Jackson 6c5e099be9 handshake: Use read_exact, not read and checking len
read_exact has a loop in it, which we need.

This means we end up separating the two sites that generate the "not a
relay" error, so we need to fish out the error construction.

As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/249#note_2771023
2022-01-19 18:45:53 +00:00
Ian Jackson c433899948 clippy: Rename a `from_foo` method that doesn't do conversion 2022-01-19 17:26:09 +00:00
Ian Jackson 1d5a480f79 Fix two bugs related to incomplete read/write
Discovered by clippy
2022-01-19 17:17:56 +00:00
eta c003fde04d Merge branch 'channel-arc-rework-5' into 'main'
chanmgr: get rid of Arc around Channel

See merge request tpo/core/arti!236
2022-01-13 13:12:30 +00:00
Ian Jackson 9b723cba53 chanmgr: get rid of Arc around Channel 2022-01-13 13:12:29 +00:00
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 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
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 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 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
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
eta ea41fa3346 Merge branch 'refactor/unwrap-or-default' into 'main'
prefer 'unwrap_or_default' to manual constructor

See merge request tpo/core/arti!215
2022-01-06 15:36:12 +00:00
Nick Mathewson 5c3300867d Merge remote-tracking branch 'origin/mr/214' 2022-01-06 09:02:09 -05:00
Nick Mathewson c15168be61 Merge remote-tracking branch 'origin/mr/212' 2022-01-06 08:28:13 -05:00
Daniel Eades d68e934716 prefer 'unwrap_or_default' to manual constructor 2022-01-01 19:14:29 +00:00
Daniel Eades 592642a9e6 extend lints to include 'clippy::all' 2021-12-28 20:15:40 +00:00
Neel Chauhan 383843f0d7 tor-circmgr: Don't clone parameters in create_chantarget() 2021-12-25 17:22:38 -08:00
Neel Chauhan 7dba3d8c51 tor-proto: In begin_stream_impl(), if number of hops is zero, don't continue 2021-12-25 16:01:22 -08:00
Nick Mathewson 6303a71d58 tor-proto: Replace XXXs with references to arti#269
These will require thought; should we ignore them, act on them, or
continue to  treat them as internal errors?
2021-12-20 10:56:24 -05:00
Nick Mathewson 64257a10fa tor-proto: Allow one meta-cell handler at a time.
Previously the code would let us try to install a meta-cell handler
before the old one was done, leading to possible confusion.
2021-12-16 16:01:50 -05:00
eta 6a12f388f2 Merge branch 'ct_sendme_tags' into 'main'
tor-proto: use const-time eq on sendme tags.

See merge request tpo/core/arti!201
2021-12-16 20:29:01 +00:00
Nick Mathewson 51c4ca73f2 tor-proto: set HalfStream::connected_ok right.
Previously we'd always set it to true, allowing one CONNECTED per
half-closed stream even if the stream had already received a
CONNECTED  cell.

This resolves an XXXX.
2021-12-16 11:48:39 -05:00
Nick Mathewson a09fbc9f27 tor-proto: replace a streammap XXXX with a ticket. 2021-12-16 11:33:50 -05:00
Nick Mathewson d794355b07 tor-proto: use const-time eq on sendme tags.
There's no known attack here, but it's best practice to always compare
digests using a constant-time comparison operator.

This resolves an XXXX comment.
2021-12-16 11:06:30 -05:00
Nick Mathewson e2dd418c84 tor-proto: document an infelicitous behavior.
This was an XXXX before. Now it explains why the behavior is safe for
now, but maybe not forever.
2021-12-16 10:39:00 -05:00
Nick Mathewson f73840544c Extend trace messages for destroy/truncated reasons.
It makes sense to put the method for human-readable strings onto the
type itself, so that we can format these whenever they occur.

I'm choosing the "human_str" method name here, since caret-generated
types already have a to_str.  I was thinking about using Display,
but caret types already implement that.

I've also moved the message from "warn!" to "debug!", since these
aren't necessarily a problem condition.
2021-12-15 11:33:48 -05:00
Nick Mathewson 1cf0b87eb7 Merge remote-tracking branch 'origin/mr/191' 2021-12-15 10:46:58 -05:00
eta 2e0ff665bb Merge branch 'check_put_return' into 'main'
Always check whether stream-level SENDMEs are expected.

Closes #261

See merge request tpo/core/arti!192
2021-12-15 15:45:08 +00:00
Neel Chauhan 043b97fecf In reactor, use enums on whether to destroy circuits 2021-12-14 14:36:30 -08:00
Neel Chauhan b601d8b147 Methodize the destroy circuit reason 2021-12-14 14:26:45 -08:00
Nick Mathewson d5c2361d3f Always check whether stream-level SENDMEs are expected.
(It's a protocol violation to get a SENDME when our send window is
already full.)

This patch makes SendWindow::put return a Result, so that it's
easier to do the right thing with it.

Closes #261.
2021-12-14 17:11:48 +00:00
eta 8d660cbcf1 Actually decrement the stream-level SENDME window
arti!126 overhauled the `tor-proto` circuit reactor, but left out one
very important thing: actually decrementing the SENDME window for
streams (not circuits) when we send cells along them.

Since the circuit-level SENDME window would often prevent us from
running into a problem, this wasn't caught until my benchmarking efforts
noticed it (in the form of Tor nodes aborting the circuit for a protocol
violation).

fixes arti#260
2021-12-14 16:37:56 +00:00
Neel Chauhan 2595f3f8c1 Handle TRUNCATED cells 2021-12-13 12:21:25 -08:00
Neel Chauhan b6ef659311 Log on TRUNCATED cell 2021-12-13 12:21:19 -08:00
Trinity Pointard 9753a7ee06 fix nightly clippy errors 2021-12-09 12:16:23 +01:00
Nick Mathewson d0b217d1a5 Beautify some Vec->array code in tor-proto.
[T;N] supports TryFrom<Vec<T>>, and has since Rust 1.48: we can just
use that.

This resolves an XXXX comment.
2021-12-08 14:01:06 -05:00
Nick Mathewson 9a8c91bdf8 Merge remote-tracking branch 'origin/mr/180' 2021-12-08 12:39:02 -05:00
Neel Chauhan 2d915ed684 In CryptInit, return a Result in initialize() 2021-12-08 08:38:56 -08:00
Nick Mathewson 4536c2ac87 Upgrade to digest v0.10.0
We generally try to track the latest rust-crypto traits when we can:
fortunately, this upgrade didn't break much, considering.
2021-12-07 20:33:46 -05:00
Nick Mathewson 36f6a61f05 Remove some XXXs about zeroizing from tor-proto.
There is now a ticket about this issue in general, at arti#254.
2021-12-07 11:21:48 -05:00
Nick Mathewson 31b385c5b2 Resolve roughly half of the XXXXs.
We want to only use TODO in the codebase for non-blockers, and open
tickets for anything that is a bigger blocker than a TODO.  These
XXXXs seem like definite non-blockers to me.

Part of arti#231.
2021-12-06 15:11:03 -05:00
dagon 0c10f4ea0b add constructors 2021-11-30 23:51:03 +10:00
Nick Mathewson eef81d9d57 Bump every crate by one patch version. 2021-11-29 15:21:58 -05:00
Nick Mathewson efe165acf3 Mark a test as #[ignore]
This test seems unreliable on CI: we've got to disable them for now
so that we have a working CI system.  The CI failure is #238; the
ticket to repair them is #244.
2021-11-29 11:10:51 -05:00
Daniel Eades db16d13df4 add semicolons if nothing returned 2021-11-25 13:20:37 +00:00
Nick Mathewson 3e7e599a22 More typo fixes that I forgot to save :( 2021-11-24 18:23:12 -05:00
Nick Mathewson 54de7f5cfd Remove a couple more eprintln! calls. 2021-11-23 17:40:13 -05:00
Nick Mathewson 672b111262 Try to make the tor_proto::circuit::begindir test more reliable.
I traced the problem here to the fact that sometimes "rx" in this
test would be dropped before the test was done.  When "rx" is
dropped, the channel reactor shuts down, which in turn kills off the
circuit reactor.

This bug may exist in other cases in these tests.  This patch may
fix one case of #238.
2021-11-23 10:50:20 -05:00
eta 075e663dcd Make unreliable tor-proto tests more reliable (arti#238).
The `bad_extend_*` failures were caused by bad test code in
`bad_extend_test_impl` that used `futures::join!`; this meant that the
reactor could receive the `Extended2` cell before it actually got the
`ExtendNtor` request, which caused it to get (quite rightly) confused
and close the circuit. Spawning a background thread which has a short
delay before sending the `Extended2` cell seems to have alleviated this
problem.

`new_circ_create_failure` is similar; I think the reactor was getting
dropped before it had a chance to flush out its `CreateFast` cell
properly, because it had already gotten the result back (since the test
code sends it indiscriminately). This was "fixed" in much the same
manner as the other test: making it wait a bit before sending the result
cell back.

There seem to be other tests that use `futures::join!` (like
`begindir`?), and use similarly erroneous patterns; I haven't gotten any
to fail reliably enough to be able to debug them, though.
2021-11-18 16:06:53 +00:00
Nick Mathewson cc3efccdcc Always use optimistic data for begindir connections.
Closes #226.
2021-11-16 15:20:44 -05:00
Nick Mathewson f92ad644c9 tor-proto: Use tor-rtcompat macros for testing, not tokio.
Closes #222.
2021-11-15 12:57:01 -05:00
Nick Mathewson 787a995458 tor-proto: Stop using async_test in halfstream.rs and sendme.rs
Thanks to eta's refactoring, these tests no longer need to be async.
2021-11-15 12:12:53 -05:00
Nick Mathewson c6d188869f A few more eprintln!() removals that I missed. 2021-11-13 11:22:08 -05:00
Nick Mathewson 20b179bfa9 Replace or remove testing eprintln!()s.
The clippy code for warning about these on nightly CI can't tell the
difference between cfg(test) and no cfg(test).
2021-11-13 11:17:49 -05:00
Nick Mathewson b26fbdb24f Resolve a dead-code warning on nightly.
The `circid` field in `ClientCirc` is now testing-only.
2021-11-13 11:14:11 -05:00
eta c559754116 Get rid of unbounded stream sender, and RawCellStream
Previously, the reactor would use an `UnboundedSender` to send things to
the `RawCellStream`, in order that the reactor wouldn't block if you
failed to read from the latter. This is bad, though, since it means
people can just run us out of memory by sending lots of things.

To fix this, we make the new `StreamReader` type (which does the reading
parts from `RawCellStream`) keep track of the stream's receive window
and issue SENDMEs once *it* has consumed enough data to require it, thus
meaning that we shouldn't get sent enough data to fill the channel
between reactor and `StreamReader` (and, if we do, that's someone trying
to flood us, and we abort the circuit).

As hinted to above, the `RawCellStream` was removed and its reading
functionalities replaced by `StreamReader`; its writing functionalities
are handled by `StreamTarget` anyway, so we just give out one of those
for the write end. This now means we don't need any mutexes!

note: this commit introduces a known issue, arti#230
2021-11-12 15:04:27 +00:00
eta 197816d14c Completely overhaul the tor-proto circuit reactor
Rather like e8e9699c3c ("Get rid of
tor-proto's ChannelImpl, and use the reactor more instead"), this
admittedly rather large commit refactors the way circuits in `tor-proto`
work, centralising all of the logic in one large nonblocking reactor
which other things send messages into and out of, instead of having a
bunch of `-Impl` types that are protected by mutexes.

Congestion control becomes a lot simpler with this refactor, since the
reactor can manage both stream- and circuit-level congestion control
unilaterally without having to share this information with consumers,
meaning we can get rid of some locks.

The way streams work also changes, in order to facilitate better
handling of backpressure / fairness between streams: each stream now has
a set of channels to send and receive messages over, instead of sending
relay cells directly onto the channel (now, the reactor pulls messages
off each stream in each map, and tries to avoid doing so if it won't be
able to forward them yet).

Additionally, a lot of "close this circuit / stream" messages aren't
required any more, since that state is simply indicated by one end of a
channel going away. This should make cleanup a lot less brittle.

Getting all of this to work involved writing a fair deal of intricate
nonblocking code in Reactor::run_once that tries very hard to be mindful
of making backpressure work correctly (and congestion control); the old
code could get away with having tasks .await on things, but the new
reactor can't really do this (as it'd lock the reactor up), so has to do
everything in a nonblocking manner.
2021-11-12 15:04:24 +00: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
Nick Mathewson 428b19c121 Refactor wait_for_connection a bit.
* Make it crate-visible only.
* Make it idempotent
* Have it be an internal error if it's called at the wrong time.
* Simplify the return logic.
2021-11-10 10:33:31 -05:00
Yuan Lyu 7f799c956b Implement optimistic stream 2021-11-09 21:36:12 -05:00
Nick Mathewson 83d9f2299e Replace all println/eprintln calls outside of arti CLI with trace. 2021-11-04 11:04:59 -04:00
eta db6b91164e tor-proto: Use a dedicated sender for channel cells, make full-duplex
@nickm pointed out that refactoring tor_proto::channel's Reactor to do
sending as well meant that it could only send or receive, but not both,
simultaneously, which was bad!

To fix this, rewrite Reactor::run_once to use a handcrafted future (with
futures::future::poll_fn) that can handle the logic required to push
items onto the sink asynchronously (i.e. checking that it can be written
to before trying to do that, and then flushing it).

This also means we don't use select_biased! any more, and just handroll
that logic ourselves; as a small bonus, we can now process all 3 kinds
of message in one run_once() call, instead of having to do only one of
them.
2021-11-03 16:48:54 +00:00
eta e8e9699c3c Get rid of tor-proto's ChannelImpl, and use the reactor more instead
Instead of awkwardly sharing the internals of a `tor-proto` `Channel`
between the reactor task and any other tasks, move most of the internals
into the reactor and have other tasks communicate with the reactor via
message-passing to allocate circuits and send cells.

This makes a lot of things simple, and has convenient properties like
not needing to wrap the `Channel` in an `Arc` (though some places in the
code still do this for now).

A lot of test code required tweaking in order to deal with the refactor;
in fact, fixing the tests probably took longer than writing the mainline
code (!). Importantly, we now use `tokio`'s `tokio::test` annotation
instead of `async_test`, so that we can run things in the background
(which is required to have reactors running for the circuit tests).

This is an instance of #205, and also kind of #217.
2021-11-03 13:19:45 +00:00
Nick Mathewson 656a8e5f48 Merge branch 'timestamp' 2021-11-02 12:17:15 -04:00
Nick Mathewson dddf67a902 Use coarsetime to build an incoming traffic timestamp.
We need this for the circuit timeout estimator (#57).  It needs to
know "how recently have we got some incoming traffic", so that it
can tell whether a circuit has truly timed out, or whether the
entire network is down.

I'm implementing this with coarsetime, since we need to update these
in response to every single incoming cell, and we need the timestamp
operation to be _fast_.

(This reinstates an earlier commit, f30b2280, which I reverted
because we didn't need it at the time.)

Closes #179.
2021-11-02 12:17:11 -04:00
eta 2979bb22a2 Refactor tor_proto::circuit::Reactor to use an UnboundedSender
Basically the same thing as 371437d338
("Refactor tor_proto::channel::Reactor to use an UnboundedSender"), but
for tor_proto::circuit's Reactor instead.

(part of arti#217)
2021-11-02 14:26:25 +00:00
Nick Mathewson 118fddb15f Merge remote-tracking branch 'origin/mr/118' 2021-11-02 10:14:58 -04:00
eta 371437d338 Refactor tor_proto::channel::Reactor to use an UnboundedSender
There wasn't any good reason for tor-proto's channel reactor to use a
shedload of oneshot channels instead of just an mpsc UnboundedSender,
and the whole `CtrlResult` thing made even less sense.

Straighten this code out by replacing all of that machinery with a
simple UnboundedSender, instead.

(part of arti#218)
2021-11-02 14:02:58 +00:00
Nick Mathewson cdae4c033c Remove some dbg!() calls in real code. 2021-11-02 09:50:55 -04:00
Nick Mathewson e6e740646a Bump all crate versions to 0.0.1 2021-10-29 11:05:51 -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 2057142671 Use correct link for AsyncWriteExt::flush 2021-10-28 20:48:54 -04:00
Nick Mathewson c8f65e532e DataStream: document the importance of flush(). 2021-10-28 20:21:35 -04:00
Nick Mathewson 134c04a67a Update our disclaimers and limitations sections. 2021-10-27 11:13:46 -04:00
Nick Mathewson b477f12d83 s/arti-arti-client/arti-client/ and regenerate readme files 2021-10-25 08:40:00 -04:00