Commit Graph

1584 Commits

Author SHA1 Message Date
Nick Mathewson 84f81d14eb guardmgr: Don't use guards that are marked as unlisted.
Closes #202.
2021-10-25 10:27:13 -04:00
Nick Mathewson b477f12d83 s/arti-arti-client/arti-client/ and regenerate readme files 2021-10-25 08:40:00 -04:00
Nick Mathewson 529d5d5efb Fix a typo in a comment. 2021-10-25 08:25:59 -04:00
Nick Mathewson c4710ce929 Remove chrono exception from cargo_audit.sh 2021-10-24 11:33:12 -04:00
Nick Mathewson 968ffa3d6c Migrate tor-dirmgr from chrono to time 0.3
(This appears to be the emerging consensus of how to handle
RUSTSEC-2020-0159.)
2021-10-24 11:12:06 -04:00
Nick Mathewson 4893e9a15f Migrate tor-netdoc from chrono to time 0.3
(This appears to be the emerging consensus of how to handle
RUSTSEC-2020-0159.)
2021-10-24 10:50:21 -04:00
Nick Mathewson 89de07686d Upgrade to latest tracing-{subscriber,journald} 2021-10-23 22:23:26 -04:00
Nick Mathewson fa266c5644 Upgrade to new version of simple_asn1. 2021-10-22 15:44:37 -04:00
Nick Mathewson e00a1c59ae Run "cargo fix --edition-idioms=2018". 2021-10-22 09:05:45 -04:00
Nick Mathewson 730be38867 Replace references to arti-client in the documentation. 2021-10-21 14:22:21 -04:00
Nick Mathewson 7c7a388e28 Rename tor_client/arti_tor_client to arti_client.
Solves a name conflict with the existing tor_client create.

Closes #130.
2021-10-21 14:22:11 -04:00
Nick Mathewson e9a29b4523 Remove #![allow(clippy::unnecessary_wraps)] in tor-proto. 2021-10-21 14:03:32 -04:00
Nick Mathewson 6af5700c5d Remove #![allow(unreachable_pub)] in shared_ref.rs 2021-10-21 14:00:38 -04:00
Nick Mathewson babd0b53ae Remove #![allow(clippy::unwrap_used)] in cmdline.rs 2021-10-21 13:59:37 -04:00
Nick Mathewson 55ef69724c Remove #![allow_unused] in tor_chanmgr::mgr 2021-10-21 13:48:06 -04:00
Nick Mathewson 7159941ae1 Remove #![allow(dead_code)] in timeouts.rs 2021-10-21 13:42:53 -04:00
Nick Mathewson f3dc66d964 Merge branch 'share_state' 2021-10-21 13:34:38 -04:00
Nick Mathewson 8a99833777 Implement the guard side of shared state directories. 2021-10-21 13:31:38 -04:00
David Goulet b863e63a21 fallbackdir: Regenerate list for October 2021
Closes #200

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-10-21 09:18:03 -04:00
Nick Mathewson fdddb74de4 Mark consensus as "not-pending" even if its microdescs come from cache.
Previously our code would clear the 'pending' flag on a consensus
only when a _downloaded_ md made it become usable.

Closes #199.
2021-10-20 14:04:54 -04:00
Nick Mathewson 43506601dc Move tor-dirmgr to use a sync::Mutex.
The futures:🔒:Mutex was unnecessary, since we never held it
when we were suspending.
2021-10-20 13:46:44 -04:00
Nick Mathewson c8cfbda339 Finish the timeout-inference side of shared state. 2021-10-20 13:13:15 -04:00
Nick Mathewson db0921fd7e Add a timeout estimator to take estimates from another process. 2021-10-20 12:41:59 -04:00
Nick Mathewson 16ec1d21f2 Allow type of timeout estimator to change at runtime.
This is a big change, but it does simplify the type of Builder a
little, and isolates locking across different (potential) timeout
estimator types.
2021-10-20 12:06:58 -04:00
Nick Mathewson fe85f44fd0 Remove try_lock from StorageHandle. 2021-10-20 09:42:34 -04:00
Nick Mathewson 7b6ed9dab6 Replace the return type of StorageMgr::try_lock with a tristate
It's useful to know now only if we now have the lock, but also if we
just got it for the first time.
2021-10-20 09:37:53 -04:00
Nick Mathewson 650c5a358c Remove unused d_pre from DiffResult. 2021-10-20 08:17:37 -04:00
Nick Mathewson b53abdb67e Implement the "request_loyalty" configuration option 2021-10-19 16:25:52 -04:00
Nick Mathewson 445ec6d220 Fix most warnings from nightly.
(One represents code that I forgot to write.)
2021-10-19 16:21:12 -04:00
Nick Mathewson fc1556461f Fix a broken rustdoc link. 2021-10-19 16:07:13 -04:00
eta e4a3ae492a tor-client/examples: add `hyper` example
The new `hyper` tor-client example demonstrates integrating arti with the
popular Rust `hyper` HTTP library by implementing a custom Hyper "connector"
(a type that can initiate connections to HTTP servers) that proxies said
connections via the Tor network.
2021-10-19 15:59:02 -04:00
Nick Mathewson fb2c7cb85a Also implement tokio Async{Read,Write} on Data{Reader,Writer}.
This will let callers use the tokio traits on these types too, if
they call `split()` on the DataStream.

(Tokio also has a `tokio::io::split()` method, but it requires a
lock whereas `DataStream::split()` doesn't.)
2021-10-19 15:49:49 -04:00
Nick Mathewson a9a9f70eb9 Add a little documentation about when you'll need the tokio trait. 2021-10-19 15:48:55 -04:00
Nick Mathewson f5a7916717 Merge remote-tracking branch 'origin/mr/97' 2021-10-19 15:39:18 -04:00
Nick Mathewson ed6ca1bc18 Move TorClientBuilder into tor_client::config, for consistency. 2021-10-19 15:34:27 -04:00
Nick Mathewson d245147c7f Make elements of TorClientConfig private. 2021-10-19 15:29:36 -04:00
eta ccd1d36e90 tor-proto: implement tokio Async{Read, Write} traits conditionally
futures::io::AsyncRead (and Write) isn't the same thing as tokio::io::AsyncRead,
which is a somewhat annoying misfeature of the Rust async ecosystem (!).

To mitigate this somewhat for people trying to use the `DataStream` struct with
tokio, implement the tokio versions of the above traits using `tokio-util`'s
compat layer, if a crate feature (`tokio`) is enabled.
2021-10-19 19:59:29 +01:00
eta b42a6712c9 tor-client: refactor TorClient::bootstrap's args into a config object
The three arguments TorClient::bootstrap requires by way of configuration
have been factored into a new TorClientConfig object.

This object gains two associated functions: one which uses `tor_config`'s
`CfgPath` machinery to generate sane defaults for the state and cache
directories, and one that accepts said directories in order to create a
config object with those inserted.

(this commit was inspired by trying to use arti as a library and being somewhat
overwhelmed by the amount of config stuff there was to do :p)
2021-10-19 19:59:25 +01:00
Nick Mathewson 89d1fb1767 Initial work on periodically reloading state.
We can use this in the case where we don't get the lock on the
state file, because another process is running.
2021-10-19 11:26:22 -04:00
Nick Mathewson 6b26ae20a1 On startup, try to lock the state file, and log whether we succeed.
Previously we'd try to grab the lock the first time we wrote to the
file.
2021-10-19 10:41:44 -04:00
Nick Mathewson 36353aacd8 Fix some typos in comments.
Also, tell the "typos" tool to ignore Cargo.lock.
2021-10-19 10:40:32 -04:00
Nick Mathewson 457e7f064c Reverse two swapped log messages 2021-10-19 10:24:19 -04:00
Nick Mathewson 26e1b6fb72 Improve logging when trying to get the lock on the directory cache.
Previously we'd say that we were "waiting for the other process to
bootstrap" even if it was already bootstrapped: and we wouldn't
actually declare success when it was done.
2021-10-19 10:18:02 -04:00
Nick Mathewson 193148c12d Remove Guard::get_relay(); use Guard::guard_id().get_relay().
The `get_relay` function was confusing, since it would return None if
the relay was present, but wasn't actually a guard.  We only used it
in one place, and in that one place we used it wrong, leading to a
panic bug.

Fixes #193.
2021-10-19 08:33:55 -04:00
Nick Mathewson 5b6a862096 Upgrade to latest chrono; update cargo_audit.sh
Thanks to the chrono update, we no longer include an
obsolete/vulnerable version of the `time` crate.  Unfortunately, it
turns out that chrono has the same trouble as `time`: it, too, looks
at the environment via localtime_r, and the environment isn't
threadsafe.

One step forward, one step back.  At least the underlying issue is
one that lots of people seem to care about; let's hope they come up
with a solution.
2021-10-19 08:03:41 -04:00
Nick Mathewson 45fb7022df Remove special-case for ipv6 in is_valid_hostname 2021-10-18 14:56:12 -04:00
Nick Mathewson b63fee25b2 Use a proper RFC5737 address in tests. 2021-10-18 14:53:01 -04:00
Nick Mathewson 539982bf8e Add the "clock" feature to chrono in netdoc.
This seems to fix a bug when running cargo check on netdoc individually.

Reported by @janimo
2021-10-18 14:40:02 -04:00
Nick Mathewson 0750199a8c Move hostname enforcement into TorAddr. 2021-10-18 14:32:05 -04:00
Nick Mathewson 5ae433c747 Change how we connect to target addresses.
Now we all both address:port, (address, port), and more.

We also allow SocketAddr and IpAddr, but only via a trait
labeled as "Dangerous".
2021-10-18 14:03:38 -04:00