Commit Graph

417 Commits

Author SHA1 Message Date
Nick Mathewson 08267147ec Merge remote-tracking branch 'origin/mr/156' 2021-11-30 15:21:02 -05:00
Nick Mathewson c733374693 Merge remote-tracking branch 'origin/mr/154' 2021-11-30 14:12:08 -05:00
Nick Mathewson e2a7289aa7 Add comments about the absence of tap_key in microdesc. 2021-11-30 14:05:13 -05:00
Nick Mathewson 9afe5c09e7 Merge remote-tracking branch 'origin/mr/151' 2021-11-30 14:03:46 -05:00
Nick Mathewson 8dde60ca60 Merge remote-tracking branch 'origin/mr/160' 2021-11-30 13:57:43 -05:00
Nick Mathewson a49ee4d5f4 Merge remote-tracking branch 'origin/mr/159' 2021-11-30 13:53:53 -05:00
eta 9a94f72e42 Add tests & address review commentary 2021-11-30 16:58:08 +00:00
Nick Mathewson 3b072c5420 Merge branch 'readme_fixes' 2021-11-30 09:12:51 -05:00
dagon 0162ea8210 Example needs to be the same as the readme 2021-11-30 09:09:42 -05:00
dagon bd1c37fe8a MR review feedback 2021-11-30 09:09:42 -05:00
dagon e0489328f6 fix arti-client doc example 2021-11-30 09:09:42 -05:00
dagon c2d357988c fix example for retry-error 2021-11-30 09:09:42 -05:00
dagon 0c10f4ea0b add constructors 2021-11-30 23:51:03 +10:00
Nick Mathewson b9ad2f917c Fix a documentation link. 2021-11-30 08:37:21 -05:00
dagon 9a8d883f35 remember utf8 check 2021-11-30 23:26:47 +10:00
dagon 0122e15339 dont warn on bootstrap error when error == manager dropped 2021-11-30 21:50:27 +10:00
Nick Mathewson c5181dc7f0 Fix a bad rustdoc reference. 2021-11-29 21:04:40 -05:00
eta 2920a4d084 Merge branch 'simplify_config_helpers' into 'main'
Change sane_defaults() and with_directories()

See merge request tpo/core/arti!155
2021-11-29 20:42:28 +00:00
Nick Mathewson eef81d9d57 Bump every crate by one patch version. 2021-11-29 15:21:58 -05:00
Nick Mathewson 805e558045 Run "cargo update" to get latest versions.
Also fix a couple of warnings introduced by now-unneeded imports
with new ed25519 crate.

This is part of the process for releasing our next version.
2021-11-29 14:52:53 -05:00
Nick Mathewson f107794b74 Change sane_defaults() and with_directories()
The sane_defaults() call is now the same as you get from a default
builder: by convention, we just call that method Default::default().

The with_directories() constructor makes more sense as a constructor
for the TorClientConfigBuilder than for TorClientConfig.
2021-11-29 14:20:34 -05:00
Neel Chauhan 36dc690ada arti-client: Reject Port 0 when parsing address:port combos 2021-11-29 11:09:38 -08:00
Neel Chauhan d47549b1ab Parse RSA public key 2021-11-29 11:00:53 -08:00
Nick Mathewson eb861b7edd Merge branch 'config-updates-and-tests' 2021-11-29 13:59:41 -05:00
Nick Mathewson 098547f735 Document StorageConfig defaults better.
(Also fix a couple of typos)
2021-11-29 13:55:33 -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
eta ca42139944 Actually build preemptive circuits (and minor fixes)
The new CircMgr::build_circuits_preemptively function actually causes
preemptive circuits to be built; it gets called from arti-client, like
the other daemon tasks the CircMgr has.
2021-11-29 14:47:09 +00:00
Nick Mathewson df3a790665 Merge remote-tracking branch 'origin/mr/149' 2021-11-29 09:17:01 -05:00
Nick Mathewson b640bf75d5 Merge remote-tracking branch 'origin/mr/148' 2021-11-29 09:12:32 -05:00
Neel Chauhan 2461bd86b1 tor-circmgr: Write a test for BadExit support. 2021-11-29 09:08:32 -05:00
dagon d5c48c616f run ./maint/readmes.sh 2021-11-29 21:29:28 +10:00
Neel Chauhan 50bf2e7c86 Remove address from VoterInfoBuilder 2021-11-28 20:44:27 -08:00
Neel Chauhan 2cde3608da Remove unused tap_onion_key and tap_key 2021-11-28 20:36:02 -08:00
Neel Chauhan 1d4b448ec2 Remove unused 'address' field from DirSource struct 2021-11-28 19:54:15 -08:00
Neel Chauhan c98cc793a0 In struct PendingEntry, remove circ_spec 2021-11-28 17:19:58 -08:00
Nick Mathewson f2034ac6e2 Add basic tests for high-level builders
Make sure that we can change elements, and we can reconstruct builders
that give us the same thing.
2021-11-25 09:40:16 -05:00
Nick Mathewson 3a91f363bb Implement builder patterns for ArtiConfig.
This commit implements the "metabuilder" pattern and the "builder
reconstruction" pattern for the ArtiConfig type.

I'm not 100% that this will be necessary, but it will certainly help
with testing.
2021-11-25 09:40:14 -05:00
Nick Mathewson 0b3bce2e3e Resolve some warnings in tor-config test 2021-11-25 09:39:11 -05:00
Nick Mathewson 75d977a259 Impl and test Default for high-level configs 2021-11-25 09:39:11 -05:00
Nick Mathewson 17266305e2 Ensure that all config sections have deny_unknown_fields
When we deserialize a configuration, we should reject unknown variables
(except when we have an explicit reason to allow them).
2021-11-25 09:39:11 -05:00
Nick Mathewson ecf462e4ef Make directory accessors crate-private.
These don't need to be exposed any longer.
2021-11-25 09:39:10 -05:00
Nick Mathewson 53d5f647b2 Define defaults for StorageConfig
I'm still not 100% sure this is the right move: should we encourage
app developers to always pick their own directories? Or should we
make it easy for them to use, well, `sane_defaults`?

This patch takes the second approach.
2021-11-25 09:39:09 -05:00
Daniel Eades db16d13df4 add semicolons if nothing returned 2021-11-25 13:20:37 +00:00
Daniel Eades 052f51ff71 deglob some enums, use concise iteration syntax 2021-11-25 12:39:52 +00:00
Nick Mathewson fbf72fd5af Resolve a pair of rustdoc warnings. 2021-11-24 18:24:47 -05:00
Nick Mathewson 3e7e599a22 More typo fixes that I forgot to save :( 2021-11-24 18:23:12 -05:00
Nick Mathewson e2c89b03bf Fix a clippy issue on nightly 2021-11-24 18:13:58 -05:00
Nick Mathewson f55950ab8d Fix a few typos.
Also fix some commonwealth spellings that had slipped in.
2021-11-24 18:12:44 -05:00
Nick Mathewson 9fdb7d9751 More tests for tor-config. 2021-11-24 08:38:42 -05:00
Nick Mathewson 54de7f5cfd Remove a couple more eprintln! calls. 2021-11-23 17:40:13 -05:00
Nick Mathewson 310b5da752 Avoid a warning about retain_mut() in nightly.
Rust nightly claims that Vec might get its own retain_mut method,
which would potentially conflict with the extension method we've
grabbed from the retain_mut crate.  To solve this, we're calling the
method explicitly.
2021-11-23 15:49:24 -05:00
Nick Mathewson 67438528cf Merge remote-tracking branch 'origin/mr/140' 2021-11-23 15:24:31 -05:00
Neel Chauhan 22f2a69636 Use guard-extreme-restriction-percent 2021-11-23 09:26:24 -08:00
eta 8a5a9575c6 Introduce PreemptiveCircuitPredictor and TargetCircUsage::Preemptive
In preparation for making Arti build circuits preemptively, this commit
introduces `TargetCircUsage::Preemptive`, a circuit usage that works
somewhat differently from other ones: it requires at least 2 circuits to
exist that can exit the port it contains in order for an existing
circuit to match against it (path-spec.txt § 2.1.1); if that's not the
case, that usage will require building new circuits (in order that we
build enough to have 2 available).

This required refactoring how circuit reuse worked; now,
`CircList::find_open` uses the new `AbstractSpec::find_supported` trait
method, which we customize to implement the above check in the case of
`Preemptive` circuit usages. To make that work, `OpenEntry` now takes
two type parameters (the spec and circuit types), instead of taking a
builder type parameter and using its associated types. (We also got rid
of type constraints on that struct, yay!)

A WIP implementation of a preemptive circuit predictor that implements
path-spec.txt § 2.1.1 is also included, but this will require additional
effort to wire it up with the `CircMgr` properly.
2021-11-23 16:37:52 +00: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 f2c2dac54b Merge branch 'event-warnings' into 'main'
Add and resolve clippy warnings in tor-events.

See merge request tpo/core/arti!138
2021-11-23 13:34:43 +00:00
Neel Chauhan 8c80b5d869 Fix typo in tor-guardmgr comment related to suspicious guards 2021-11-22 20:48:30 -08:00
Neel Chauhan c36973d6d8 In guard filtering code, warn if the filter is too small according to guard params 2021-11-22 20:45:34 -08:00
Nick Mathewson 9479001649 Add and resolve clippy warnings in tor-events.
Here we add the same array of clippy warnings as usual to the new
tor-event crate, and resolve the issues that triggered any of them.
2021-11-22 11:49:31 -05:00
eta e35a8bf60e Merge branch 'arti-client-config' into 'main'
Further configuration refactoring

See merge request tpo/core/arti!137
2021-11-22 15:43:22 +00:00
Nick Mathewson 307ca9b4d0 Implement meta-builder pattern for TorClientConfig
This should be ergonomic than having to construct every section of the
configuration separately.
2021-11-22 14:53:52 +00:00
eta ee2ec31ede Merge commit '98f38dc' (arti!131) into HEAD
This commit message totally gives away the cursed way in which I use
git. branches? what are those?
2021-11-22 14:40:18 +00:00
eta 98f38dc186 Initial cut at a typed event framework for arti (arti#230).
This implements a basic typed event broadcast mechanism, as described in
arti#230: consumers of the new `tor-events` crate can emit `TorEvent`
events, which others can consume via the `TorEventReceiver`.

Under the hood, the crate uses the `async-broadcast`
(https://github.com/smol-rs/async-broadcast) crate, and a
`futures::mpsc::UnboundedSender` for the event emitters; these are glued
together in the `EventReactor`, which must be run in a background thread
for things to work. (This is done so event sending is always cheap and
non-blocking, since `async-broadcast` senders don't have this
functionality.)

Additionally, the `TorEventKind` type is used to implement selective
event reception / emission: receivers can subscribe to certain event
types (and in fact start out receiving nothing), which filters the set
of events they receive. Having no subscribers for a given event type
means it won't even be emitted in the first place, making things more
efficient.
2021-11-22 14:39:38 +00:00
Nick Mathewson 354a0f97f2 Use consistent name for ns_consensus feature. 2021-11-21 21:11:14 -05:00
Nick Mathewson 40ff7113d4 Make every Config type implement Eq.
Doing this is necessary for reconfiguration support, and will help a lot
with testing, too.
2021-11-21 12:06:15 -05:00
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
Trinity Pointard 03f8966f0d use 3des instead of rc2 in .pfx test fixture 2021-11-18 09:07:48 +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
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