Commit Graph

151 Commits

Author SHA1 Message Date
Ian Jackson 8d54c0f073 Change type of TorClientConfig::override_net_params
Now we use NetParams.  That implies making its constructor public,
which I think it fine.

This is related to #413 but is far from completing that ticket.
2022-03-16 19:30:59 +00:00
Nick Mathewson 67645473d5 Move RetryDelay from dirmgr to basic-utils.
This (almost) a pure code-movement commit: it also makes one public
function private in order to suppress a warning.
2022-03-16 08:31:54 -04:00
trinity-1686a 604362bf80 actually add DNS support 2022-03-14 21:04:38 +01:00
eta 258e42ad3e Merge branch 'slice-from-ref' into 'main'
Simpify tor-netdoc TokVal

See merge request tpo/core/arti!404
2022-03-14 13:14:05 +00:00
Ian Jackson 8f5d089f53 Revert "humantime_serde_option: New module in tor-basic-utils"
We have upstreamed this code.

This reverts commit 6193c9d974.
2022-03-14 10:33:59 +00:00
Ian Jackson 8b8c2a426e humantime: Update to humantime-serde 1.1.1
This has the humantime_serde::option module, which we have upstreamed
and are about to switch to.

The remaining dependency with  version = "1"  is going to be removed
in a moment.
2022-03-14 10:33:59 +00:00
Ian Jackson 888eea47b3 tor-netdoc: Actually, make TokVal be a Vec
This enum was otiose: its set of valid values is precisely those of a
Vec.  (Indeed what would TokVal::Multi(vec![]) have meant?)
2022-03-11 18:42:01 +00:00
Ian Jackson 6761cf2b69 Merge branch 'config-no-retcon' into 'main'
Drop config back-conversion from FooConfig to FooConfigBuilder

See merge request tpo/core/arti!391
2022-03-10 14:47:01 +00:00
Ian Jackson 416b56d852 Use git source for derive_builder for now, for attrs feature
We are going to want to specify custom attributes on fields of the
builder struct.  This feature was missing from derive_builder.

This commitid is the current head of my MR branch
  https://github.com/colin-kiegel/rust-derive-builder/pull/237
  https://github.com/ijackson/rust-derive-builder/tree/builder-field-attrs
Using the commitid prevents surprises if that branch is updated.

We will require this newer version of derive_builder.  The version
will need to be bumped again later, assuming the upstream MR is merged
and upstream do a release containing the needed changes.
2022-03-07 15:56:57 +00:00
Nick Mathewson ca6070b962 arti-testing: Initial support for broken TCP.
This commit adds support for a BrokenTcp provider that can make
connection attempts fail or time out.  It doesn't yet have a way to
turn on the failure.
2022-03-07 10:12:48 -05:00
Ian Jackson 6193c9d974 humantime_serde_option: New module in tor-basic-utils
This will be used to allow our config *builder* structs to be
Deserialize.
2022-03-07 12:38:30 +00: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
eta 8d26726fdf Merge branch 'arti-testing-part1' into 'main'
arti-testing: Initial implementation

See merge request tpo/core/arti!378
2022-03-04 16:29:41 +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 aba68088d1 Introduce tor-basic-utils
Empty crate right now
2022-03-04 11:45:24 +00:00
Nick Mathewson 9329c7b878 arti-testing: Initial implementation
This commit adds a new program to try to implement the ideas behind
experimentation in arti#329.  In particular, it tries to implement
basic client "can I bootstrap and connect" functionality testing,
with a lot of instrumentation, and support for breaking things.

So far, the instrumentation is limited to counting TCP bytes and
connections, and counting events.  Still, this is enough to measure
behavior on some of the incorrect-clock tests.

NOTE:

For now, you are _required_ to pass in an explicit configuration, in
hopes that this will lead you to override your storage directories
for doing specific experiments.
2022-03-03 13:05:30 -05:00
Ian Jackson 1b8a8f933a Replace manual Debug impl with educe in arti-client 2022-03-02 18:06:37 +00:00
Ian Jackson decdd05ec5 Replace manual Clone impl with educe in arti-hyper 2022-03-02 18:06:37 +00:00
Ian Jackson ea03cc4084 Replace manual Clone impl with educe in tor-rtcompat 2022-03-02 18:06:37 +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 210b9b70a8 Replace manual Debug impl with educe in tor-dirmgr 2022-03-02 18:06:37 +00:00
Ian Jackson f467f4666e Replace manual Debug impl with educe in tor-chanmgr 2022-03-02 18:06:37 +00:00
Ian Jackson 1c44dfa595 Replace manual Debug impl with educe in tor-cell 2022-03-02 18:03:00 +00:00
Ian Jackson b2d8c14c90 Replace manual Debug impl with educe in tor-guardmgr 2022-03-02 18:03:00 +00:00
Ian Jackson f474a583f1 Replace manual Debug impl with educe in tor-circmgr 2022-03-02 18:03:00 +00:00
Ian Jackson c1b80d6503 Import educe into tor-bytes and provide skip_fmt
Preparatory work for getting rid of some manual Debug impls
2022-03-02 18:03:00 +00:00
Ian Jackson 72bb8e7f28 Switch to shellexpand-fork version of shellexpand
Apropos discussion in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/274
2022-03-02 12:14:51 +00:00
Nick Mathewson e8e9791a97 Bump all crates to 0.1.0 2022-03-01 08:59:34 -05:00
Nick Mathewson 8a5b766539 Final "cargo update" before relase. 2022-03-01 08:36:31 -05:00
Ian Jackson c397c772e6 arti-hyper: Provide TLS connector and make space for TLS stream
Add tls_conn field to ArtiHttpConnector (and argument to constructor).
Introduce MaybeHttpsStream and use it in ArtiHttpConnection.
Have the example program pass the native TLS connector.

Currently the TLS connector and the HTTPS variant are not used, but
this commit is very noisy and fomrulaic, so I have split out the code
to use them into a separate commit for easier preparation and review.
2022-02-28 13:07:44 +00:00
Nick Mathewson 4bd620b4ff Run "cargo upgrade" in preparation for 0.1.0.
(It's good to do this a couple of days in advance in case it turns
up any bugs.  That's how we caught the panic bug in simple_asn1
0.6.0)
2022-02-25 11:32:09 -05:00
Nick Mathewson a3bc59918d Upgrade to newer version of config crate. 2022-02-25 09:20:48 -05:00
Nick Mathewson c627f50544 Upgrade dependency to new version of rlimit. 2022-02-25 08:45:24 -05:00
Ian Jackson fc35ffd6cd arti-hyper: impl HasKind for ConnectionError 2022-02-23 14:35:41 +00:00
Ian Jackson 80d8edc51f arti-hyper: Introduce new ConnectionError type
We need this not to use anyhow because we don't want our libraries to
expose anyhow, and this is about to go into the library.
2022-02-23 14:34:53 +00:00
Ian Jackson 0cf9751d7f arti-hyper: Move hyper example from arti-client
Code motion and consequential dependency adjustments.
2022-02-23 13:55:17 +00:00
Ian Jackson 0f80be6b35 arti-hyper: empty crate skeleton 2022-02-23 13:55:14 +00:00
Ian Jackson 8c4726b55e Provide error reporter and use it in the arti binary 2022-02-18 12:10:31 +00:00
Nick Mathewson 83d001d661 Merge branch 'remaining-errors' 2022-02-17 14:22:47 -05:00
Nick Mathewson 2a7087ff93 dirmgr: Remember where netdocs came from.
This isn't complete (see TODO), but it's enough to let us report the
right ErrorKind if something fails to parse.
2022-02-16 16:28:23 -05:00
eta 30439f9dc2 Merge branch 'eta/lazy-init' into 'main'
arti-client: add ability to automatically bootstrap

Closes #278

See merge request tpo/core/arti!322
2022-02-16 20:08:38 +00:00
Nick Mathewson 49c87fa8f9 Implement HasKind for tor_dirclient::Error 2022-02-16 14:53:58 -05:00
eta 790ea4af4b arti-client: add ability to automatically bootstrap
The new `BootstrapBehavior` enum controls whether an unbootstrapped
`TorClient` will bootstrap itself automatically (`Ondemand`) when an
attempt is made to use it, or whether the user must perform
bootstrapping themselves (`Manual`).

The `lazy-init` example shows how you could write a simple
`get_tor_client()` function that used a global `OnceCell` to share
a Tor client across an entire application with this API.

closes arti#278
2022-02-16 19:29:16 +00:00
Nick Mathewson 2147d0849f Merge branch 'cell-proto-error' into 'main'
tor-cell and tor-proto: provide HasKind.

See merge request tpo/core/arti!304
2022-02-16 16:55:14 +00:00
Nick Mathewson 7b6a7a57d3 Merge branch 'doc-errors' into 'main'
Refactor errors in tor-netdoc

See merge request tpo/core/arti!314
2022-02-15 15:09:48 +00: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
Nick Mathewson b6d23c36be Refactor tor_netdoc::Error
This error type doesn't impement HasKind, since the kind will depend
on context.

However, the existing implementation was pretty messy and inconsistent:
Some errors had positions, some didn't.
Some took messages as str, some as String.
Some had internal errors that were somewhat orthogonal to their actual
types.

This commit refactors tor_netdoc::Error to use a ParseErrorKind, and
adds a set of convenience functions to add positions and
messages to the errors that need them.
2022-02-14 13:08:28 -05:00
Nick Mathewson 8ea95aee7a Simplify wait_for_bootstrap to use a Mutex.
Since the only purpose of this function is to make sure that no
bootstrapping task is running, a simple futures:🔒:Mutex
should do the job just fine.

Closes #337.
2022-02-14 09:59:37 -05:00
Nick Mathewson 7885db406a Merge branch 'eta/unbootstrapped-clients' into 'main'
Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)

Closes #293

See merge request tpo/core/arti!298
2022-02-11 17:43:46 +00:00