Commit Graph

1758 Commits

Author SHA1 Message Date
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 0c2048de60 Document (and allow) behavior for weird values of subnet masks.
Chutney needs this, to avoid putting every relay in the same family.
2021-11-18 14:39:48 -05:00
Nick Mathewson 934412586e Use named fields for the elements of ConfigBuildError 2021-11-18 14:31:34 -05:00
Nick Mathewson 96659a850b Rename RetryConfig to DownloadSchedule, fold in parallelism. 2021-11-18 12:33:08 -05:00
Nick Mathewson a1a620e451 Move the socks_port option into a new proxy section.
Now there are no options that aren't in a toml section.
2021-11-18 11:48:14 -05:00
Nick Mathewson 44f6da5f38 Rename the "network" configuration section to "tor_network".
This is more accurate, since it describes the details of the tor
network that we're connecting to.
2021-11-18 11:37:48 -05:00
Nick Mathewson d83fd2d181 Rename addr_config to address_filter; clarify its usage. 2021-11-18 11:37:48 -05:00
Nick Mathewson eba35e789c Flatten enforce_distance into path_rules.
Also use the path_rules name consistently throughout the code.
2021-11-18 11:37:48 -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 763c993e1c Merge remote-tracking branch 'origin/mr/134' 2021-11-18 11:34:35 -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
eta 2f7f016be2 Merge branch 'update-pfx' into 'main'
use 3des instead of rc2 in .pfx test fixture

Closes #239

See merge request tpo/core/arti!133
2021-11-18 14:37:28 +00:00
Trinity Pointard 03f8966f0d use 3des instead of rc2 in .pfx test fixture 2021-11-18 09:07:48 +01:00
Nick Mathewson f0dc4a973d Merge remote-tracking branch 'origin/mr/131' 2021-11-17 19:26:28 -05:00
Trinity Pointard ab8e4cb6f0 update dependencies 2021-11-17 20:17:08 +01: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
Nick Mathewson 727e420d5c Remove unused "dirs" dependency from tor-persist. 2021-11-16 15:51:35 -05:00
Nick Mathewson cc3efccdcc Always use optimistic data for begindir connections.
Closes #226.
2021-11-16 15:20:44 -05:00
eta a85e83c807 Merge branch 'ticket125' into 'main'
Put most non-universally-needed functionality behind features

Closes #125

See merge request tpo/core/arti!129
2021-11-16 18:31:00 +00:00
eta ae02b15e09 Merge branch 'issue_222' into 'main'
Use tor_rtcompat::test_with_all_runtimes!() in place of #[tokio::test]

Closes #222

See merge request tpo/core/arti!130
2021-11-16 15:28:28 +00: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 236255514a Update to simple_asn1 0.6.1.
This is a security fix for a panic.

Closes #236
2021-11-14 18:00:45 -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
Nick Mathewson 69bb6313fd Remove the unused `published` field from GenericRouterStatus.
This field isn't used in modern Tor, and has never been used in
Arti.  If tor!489 is merged, then it will no longer contain a useful
value in future consensuses.  We shouldn't store it, or else
somebody else will get the smart idea of using it for something.

This commit breaks API compatibility for tor-netdoc with the
`build_docs` feature enabled.  I haven't entered that into the
semver_status.md file, since we already have a pending tor-netdoc
API breaker in !129.
2021-11-12 13:54:03 -05:00
Nick Mathewson 2439129899 tor-dirclient: Put routerdesc download behind a feature.
Part of #125
2021-11-12 13:38:02 -05:00
Nick Mathewson e9ea7515bc tor-dirmgr: put routerdesc storage behind a feature.
(We keep routerdescs in the schema, since we don't want _that_ to
fragment.)

Part of #125.
2021-11-12 12:15:48 -05:00
Nick Mathewson 773c0dc332 tor-netdoc: put NS consensus documents behind a feature.
Clients never need these.

Part of #125.
2021-11-12 12:15:34 -05:00
Nick Mathewson 84fbff54a5 tor-netdoc: Split the two kinds of routerstatus into their own modules 2021-11-12 12:15:34 -05:00
Nick Mathewson 7b12b54d40 tor-netdoc: Put the "routerdesc" document type behind a feature.
Nothing in arti currently uses this document type.  Eventually it
will be useful for relays and for bridge clients.

I've left the "SHA1 digest of a router descriptor" type available
unconditinoally, however, since it does get used in a few places.

Part of #125.
2021-11-12 12:15:30 -05:00
Nick Mathewson 1a3292daea Remove unused tor-consdiff/src/cmd.rs file.
(Found while looking for unused features for #125)
2021-11-12 11:56:15 -05:00
Nick Mathewson fb591c51b4 tor-llcrypto: Put currently unused functions behind features.
We don't currently need a couple of the key manipulation features
that we have, since we aren't yet doing relays or onion service
clients.

Part of #125
2021-11-12 11:56:05 -05:00
Nick Mathewson e422d9f82f Merge remote-tracking branch 'origin/mr/128' 2021-11-12 11:54:20 -05:00
Trinity Pointard 6615afda8c normalize --target to better reuse build artifacts
testing was done on a different target than building, so everything was
compiled twice (actually, it's the same target, but rust doesn't realize
that)
makes build+test about 20% faster
2021-11-12 16:30:37 +01:00
eta 5bdc44d14d Merge branch 'proto-circuit-refactor' into 'main'
Completely overhaul the tor-proto circuit reactor

See merge request tpo/core/arti!126
2021-11-12 15:22:21 +00: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
Trinity Pointard 026cac0c60 try to cache cargo-audit 2021-11-12 15:47:27 +01:00
eta 4765cafd35 Merge branch 'typos' into 'main'
Fix typos

See merge request tpo/core/arti!127
2021-11-12 14:14:08 +00:00