Commit Graph

2985 Commits

Author SHA1 Message Date
eta 5d27710ef1 Merge branch 'disallowed_lint' into 'main'
Remove allow(clippy::disallowed_methods) lint flag.

See merge request tpo/core/arti!437
2022-03-30 14:02:13 +00:00
eta a24fe1413b Merge branch 'daemon-separation' into 'main'
Make daemon tasks self-contained; introduce NetDirProvider

See merge request tpo/core/arti!436
2022-03-30 13:58:45 +00:00
eta ac64bdea27 Make daemon tasks self-contained; introduce NetDirProvider
The various background daemon tasks that `arti-client` used to spawn are
now handled inside their respective crates instead, with functions
provided to spawn them that return `TaskHandle`s.

This required introducing a new trait, `NetDirProvider`, which steals
some functionality from the `DirProvider` trait to enable `tor-circmgr`
to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it
can't depend on `DirProvider` directly).

While we're at it, we also make some of the tasks wait for events from
the `NetDirProvider` instead of sleeping, slightly increasing
efficiency.
2022-03-30 14:26:43 +01:00
Nick Mathewson 537ff61ece Fix a let_and_return lint violation that had somehow slipped in. 2022-03-30 08:57:14 -04:00
Nick Mathewson 700e491813 Remove allow(clippy::disallowed_methods) lint. 2022-03-30 08:55:58 -04:00
eta fd081742fa Merge branch 'no-system-time' into 'main'
Don't use SystemTime::now()

Closes #306

See merge request tpo/core/arti!365
2022-03-30 12:44:25 +00:00
Nick Mathewson 6d7dcdc621 Update README.md files using readmes script 2022-03-29 13:30:17 -04:00
Nick Mathewson 3bab96f064 Upgrade to rusqlite 0.27.0 2022-03-29 13:27:08 -04:00
Nick Mathewson b0a978c23a Run cargo-update in preparation for Arti 0.2.0
(Doing this a few days ahead of time to give updated code time to
get testing)
2022-03-29 13:22:28 -04:00
Nick Mathewson 65b7751767 Start a changelog for Arti 0.2.0 2022-03-28 10:10:18 -04:00
Nick Mathewson 482b2e3256 Remove a now-irrelevant comment 2022-03-28 08:30:44 -04:00
Nick Mathewson 9177411951 Merge branch 'isolation-followup' into 'main'
implement IsolationHelper for StreamIsolation

See merge request tpo/core/arti!434
2022-03-28 12:29:25 +00:00
trinity-1686a 219ad39eca remove usage of 'token' where it's no longer a token 2022-03-27 13:49:08 +02:00
Ian Jackson 6e07ab1668 Merge branch 'main' into 'main'
Fixed typo on arti-client README.md

See merge request tpo/core/arti!432
2022-03-25 16:01:45 +00:00
Ian Jackson 565a3d1d01 Merge branch 'dir-filter' into 'main'
arti-client, dirmgr: Initial DirFilter code

See merge request tpo/core/arti!431
2022-03-25 15:59:54 +00:00
Nick Mathewson 24c685bcd6 Merge branch 'm' into 'dir-filter'
Simplify DirFilter API

See merge request nickm/arti!1
2022-03-25 15:06:56 +00:00
Ian Jackson 3c17b42794 DirFilter: Move nil default impls to trait default methods
This means you can write a DirFilter and only write code to mess with
the bits you want to.

Also, it is less code here.
2022-03-25 13:11:28 +00:00
Ian Jackson 678504d9f9 Abolish filter::DynFilter in favour of transparent DirFilter
There are two reasons why the DynFilter newtype might be needed:

1. To impl Default.  But we don't need it to impl Default since we can
have an accessor which does the defaulting.

2. To hide the API.  But this is usrely an unstable API.

Just writing Arc<dyn> gets rid of a lot of unnecessary boilerplate and
conversion code.
2022-03-25 13:08:56 +00:00
Ian Jackson 0846ebd6d1 Make DirFilter be Debug + Send + Sync
Abolish the handwritten Debug impl for DynFilter, which is no longer
needed.
2022-03-25 13:08:33 +00:00
eta 30e77785a0 Merge branch 'task-scheduler-2' into 'main'
Implement a periodic task scheduler, and a basic dormant mode

See merge request tpo/core/arti!429
2022-03-25 11:09:24 +00:00
trinity-1686a 85fb91deed implement IsolationHelper for StreamIsolation
but don't use it in a dyn Isolation context
2022-03-25 00:03:48 +01:00
solanav d90d1c00a7 Fixed typo on arti-client README.md 2022-03-24 21:50:27 +01:00
trinity-1686a d2edf25733 move StreamIsolation to isolation module 2022-03-24 21:12:46 +01:00
trinity-1686a 5894a43d38 implement IsolationHelper for tuple of IsolationHelper 2022-03-24 20:34:21 +01:00
trinity-1686a 80ba587937 fix with_coverage script to exclude pub(crate) mod test from results 2022-03-24 19:53:53 +01:00
trinity-1686a 8dc6e958aa move isolation in separate module 2022-03-24 19:43:54 +01:00
trinity-1686a 70f71ac90b seal trait Isolation 2022-03-24 19:05:06 +01:00
trinity-1686a de5f517da6 rename *_isolation_group to *_isolation 2022-03-24 18:56:22 +01:00
Nick Mathewson 123cd2223b Expose DirFilter from arti-client.
This will make it possible to implement a directory-munging
mechanism in arti-testing for #397.
2022-03-24 12:10:46 -04:00
Nick Mathewson c0399fc6c1 dirmgr: Initial DirFilter code.
This code sits behind a feature flag, and can be used to modify
directories before storing them.  This is part of the implementation
for #397.
2022-03-24 12:10:46 -04:00
Nick Mathewson 4354415999 Reformat {arti-client,tor-dirmgr}/Cargo.toml 2022-03-24 12:10:35 -04:00
eta ee47a16697 tor-rtcompat/scheduler: add unit tests, FireIn -> FireAt
Addressing review comments: added some unit tests for the new scheduler
type, and made FireIn use an Instant instead (making it FireAt).
2022-03-24 14:07:40 +00:00
eta 1ca79ff988 Implement a periodic task scheduler, and a basic dormant mode
This is a revised version of !397; it implements a scheduling system for
periodic tasks that can be externally controlled, and then uses the
external control aspect to implement a basic dormant mode (#90).

More technically, the scheduling system consists of a `Stream` that
periodic tasks are expected to embed in a `while` loop or similar, a
way for tasks themselves to choose how long to wait until the stream
next yields a result, and a handle to control this outside of the task.
2022-03-23 13:43:48 +00: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
eta 082a968eb8 Merge branch 'move-system-config' into 'main'
Move SystemConfig to arti::cfg

Closes #418 and #314

See merge request tpo/core/arti!427
2022-03-23 11:43:19 +00:00
eta c35bd79f5c Merge branch 'more_iso_docs' into 'main'
Expand documentation for isolation traits

See merge request tpo/core/arti!420
2022-03-23 11:42:51 +00:00
Nick Mathewson 84b98136c2 Merge branch 'channel_retries' into 'main'
Change rules for retrying guards (and marking them broken)

See merge request tpo/core/arti!426
2022-03-21 20:02:08 +00:00
Nick Mathewson ee204328dd Expand some comments based on review from @diziet. 2022-03-21 15:16:00 -04:00
Nick Mathewson 4a644a9879 circmgr: When planning, only keep one error; log them all. 2022-03-21 15:06:05 -04:00
Nick Mathewson b0b1c5c469 Merge branch 'comment' into 'main'
Adjust a comment

See merge request tpo/core/arti!428
2022-03-21 18:25:03 +00:00
Ian Jackson 9de0c024bf Adjust a comment
Noticed this while reviewing !426
2022-03-21 17:44:50 +00:00
Nick Mathewson 9ee502cbec Fix build with Rust 1.53.
Pattern bindings after `@` weren't stabilized then :/
2022-03-21 12:15:23 -04:00
Ian Jackson 1c213d4d89 Move SystemConfig to arti::cfg
Fixes #314, #418.
2022-03-21 15:54:11 +00:00
Nick Mathewson 28553d1cf4 Merge branch 'move-more-config' into 'main'
Move almost all of the rest of options.rs to arti crate

See merge request tpo/core/arti!425
2022-03-21 14:46:46 +00:00
Nick Mathewson 1ec0ed45c8 dirmgr: Note errors and inform the circmgr about them.
Some error types indicate that the guard has failed as a dircache.
We should treat these errors as signs to close the circuit, and to
mark the guard as having failed.
2022-03-21 10:27:53 -04:00
Nick Mathewson 8306a9cdcf GuardMgr:: generalize GuardId::from_relay. 2022-03-21 10:27:53 -04:00
Ian Jackson c3d56fb137 Run rustfmt to tidy up imports 2022-03-21 13:27:07 +00:00
Nick Mathewson 24e89a470f GuardMgr: new API to record guard problems from outside the crate.
We'll need this so that we can say "This guard behaved bogusly
as a directory cache; try somebody else."
2022-03-21 09:06:32 -04:00