Commit Graph

2355 Commits

Author SHA1 Message Date
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 eac440010d with_coverage: port to work with mawk
The syntax is kinda minimal, but it seems to work okay.
2021-11-24 12:55:38 -05:00
Nick Mathewson af60e0bc46 with_coverage: detect missing llvm-tools-preview
Applies a suggestion from @trinity-1686a
2021-11-24 12:33:31 -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 fac2be6783 with_coverage: include command log in index.html
This is a slight kludge, but it helps a lot to keep track of what
exactly was tested for coverage.
2021-11-23 17:09:27 -05:00
Nick Mathewson b6cefc14e8 with_coverage: Add flags to accumulate data over runs (or not)
If the -c flag is provided, we _continue_ with the previous
consensus_meta data (without deleting it).

If the -s flag is provided, we _skip_ generating the final report
(since we're going to be doing more profiling.)
2021-11-23 16:48:45 -05:00
Nick Mathewson 2a3717ef73 with_coverage: Don't try to delete absent directories
If the directories are absent, then deleting them gives you a line
in stderr, even if you do "rm -f foo || true".
2021-11-23 16:41:22 -05:00
Nick Mathewson 9c040e85b4 Let with_coverage take command-line flags.
Now the shell is controlled by the presence of an -i flag, and can
be combined with a command.

This commit also adds usage messages and better reports for a couple
of kinds of setup errors.
2021-11-23 16:37:59 -05:00
Nick Mathewson 5bd841003d with_coverage: Wipe coverage_meta at the start of each run.
Also improve comments and stdout slightly...
2021-11-23 16:03:02 -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 75a6f78e39 Add coverage_meta to .gitignore 2021-11-23 15:37:14 -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
eta d2882825ee Merge branch 'begindir_test_fix' into 'main'
Try to make the tor_proto::circuit::begindir test more reliable.

See merge request tpo/core/arti!142
2021-11-23 16:20:13 +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
Nick Mathewson 9e617fac43 Add usage string from commit message to with_coverage. 2021-11-23 09:04:59 -05:00
Trinity Pointard 06aa55cfe2 add with_coverage script
usage: with_coverage <command> [args...]: run <command> with [args...]
       with_coverage : run bash
2021-11-23 09:04:59 -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 9d1707ddb4 Update to latest fuzzing corpora 2021-11-21 21:10:50 -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