Commit Graph

514 Commits

Author SHA1 Message Date
Alexander Færøy 6fae5cc7e9 Merge branch 'upgrade_dirs' into 'main'
Bump to the lastest versions of dirs and directories.

See merge request tpo/core/arti!1072
2023-03-23 16:00:50 +00:00
Ian Jackson b6f5c066b4 Apply deferred rustfmt churn 2023-03-23 11:50:18 +00:00
Ian Jackson 9d7983a6ea arti-client: Include redacted HsId in ObtainHsCircuit error
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1071/diffs?commit_id=580fe1118dbbbfa086d11b28e3e26d7c91afe21c#fbd7ab2d6d0a5b515697d4f9f99a42ebd508aa4b_153_165
2023-03-23 11:50:18 +00:00
Ian Jackson 58311571d9 arti-client: Fix wording of docs for TorClient::isolation 2023-03-23 11:50:18 +00:00
Nick Mathewson 8a11e0f6ad arti-client: Strengthen an HS todo 2023-03-23 11:50:18 +00:00
Ian Jackson cb93d1bee7 arti-client: Call tor-hsclient to create HS connections
Obviously this still doesn't work because the actual impl in hsclient
is just a todo!().
2023-03-23 11:50:18 +00:00
Ian Jackson 3d33ad7fdf arti-client: Create an HsClientConnector 2023-03-23 11:50:18 +00:00
Ian Jackson a2aa701eb6 arti-client: Move client stream creation out of match, in connect
We want this part for HS too.
2023-03-23 11:50:14 +00:00
Ian Jackson ca73dcfb31 arti-client: Break out TorClient::isolation(prefs)
We're going to want to reuse this.

Also: rename StreamPrefs::isolation and update the docs, to better
reflect its rather limited functionality.  The new
TorClient::isolation is the only call site.
2023-03-23 11:50:14 +00:00
Nick Mathewson 19cdb239bf Bump to the lastest versions of dirs and directories. 2023-03-22 15:15:42 -04:00
Ian Jackson 8c7224ef36 Discuss in comment why we're not using a newtype for the Strings in Host 2023-03-09 18:09:11 +00:00
Ian Jackson 04d843d846 Classify OnionAddressResolveRequest as NotImplemented
We have a theory about how this ought to work, so it's noit an API
usage error - it's an unimplemented feature.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884757
2023-03-09 18:09:08 +00:00
Ian Jackson 5000d11ac3 Reject invalid hostnames
Reject them both for .onion and for "exit" hostnames

This prevents a `Host` from having an invalid hostname in it.
2023-03-09 18:09:08 +00:00
Ian Jackson 8f8df071bc Fix reference to no-longer-contemplated Host variant
Reported in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884755
2023-03-09 18:09:08 +00:00
Ian Jackson 8ead708512 Dummy HsId::from_str on .onion: Return Bug, rather than panicking
Prompted by
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884754
2023-03-09 18:09:08 +00:00
Ian Jackson 654f6689cf Improve error from HsId parse of "www.B32.onion"
And add some clarity and todos about address errors.
2023-03-09 18:09:08 +00:00
Ian Jackson 0a618cbe84 Avoid arti_client::ErrorDetail::Address for TorAddrError::InvalidHostname
Provide an explicit From impl isntead.
2023-03-09 18:09:06 +00:00
Ian Jackson c198a26bf7 arti-client: Parse .onion addresses and dispatch to client.rs
Now, a Host has a separate variant for `.onion` which is always used,
even when HS is disabled.

Currently it ends in a todo!.
2023-03-09 13:41:12 +00:00
Ian Jackson 4502528d0e arti-client: DoThingInstructions: Make error returns consistent
This is more comprehensible, and will be more convenient.
2023-03-09 13:41:12 +00:00
Ian Jackson c31bc1dafe arti-client: Host: Use Display::fmt rather than write!
write! is less good because the `{}` overwrites stuff like "did the
caller ask for padding".
2023-03-09 13:41:12 +00:00
Nick Mathewson e08c229412 Merge branch 'suffix' into 'main'
Introduce and use ends_with_ignore_ascii_case

See merge request tpo/core/arti!1058
2023-03-08 19:36:28 +00:00
Ian Jackson 198a95c74c Merge branch 'host2' into 'main'
arti-client: Do not send resolve requests for IP addrs to exits

See merge request tpo/core/arti!1057
2023-03-08 19:10:23 +00:00
Ian Jackson f15498bc3f arti-client: Host: Be more explicit about what is allowed in Hostname 2023-03-08 18:48:28 +00:00
Ian Jackson c1ae509ce6 Introduce and use ends_with_ignore_ascii_case
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1056#note_2884428
2023-03-08 18:27:42 +00:00
Ian Jackson 939027492e Rustfmt 2023-03-08 18:15:32 +00:00
Ian Jackson 257b761042 Abolish Host::into_string_and_port
When I was trying to add HS support to these layers, I found I could
add a new variant to the `Host` enum but everything would still
compile even though I hadn't written the necessary implementation!

This method is a liability: when using it, one inevitably writes such
latent bugs.
2023-03-08 18:15:32 +00:00
Ian Jackson 5df19bc888 arti-client: Do not send resolve requests for IP addrs to exits
Doing so doesn't seem like a good idea.  It might even be some kind of
leak?

Found because I added a variant to `address::Host` for hidden
services, and noticed that the resolve code still compiled.
2023-03-08 18:15:32 +00:00
Ian Jackson fd42ada54c arti-client addr handling: Introduce StreamInstructions 2023-03-08 18:09:57 +00:00
Ian Jackson 6540f260b5 arti-client: Reject .onion, when we should, without allocating
Use new strip_suffix_ignore_ascii_case
2023-03-08 17:26:47 +00:00
Nick Mathewson f41449d0bd Patchlevel bumps for remaining changed crates.
These crates have had small code changes, but no API additions:

tor-config
tor-socksproto
tor-cert
tor-chanmgr
tor-ptmgr
tor-guardmgr
tor-circmgr
tor-dirclient
tor-dirmgr
arti
tor-hsservice
tor-congestion

These crates have had API extensions:

fs-mistrust
tor-llcrypto
tor-bytes
tor-checkable
tor-linkspec
tor-netdoc
tor-persist
arti-client
2023-02-28 07:13:27 -05:00
Nick Mathewson 4479d52a88 Bump patch-versions for breaking changes in tor-hs{crypto,client}
These are API breaks, but the crates themselves are currently
100% experimental, so there's no need to bump the minor versions
according to our semver rules.
2023-02-28 07:06:15 -05:00
Nick Mathewson 3e257a7cb5 Bump minor versions for significant breaking changes.
This includes tor-cell, tor-proto, and tor-netdir.
2023-02-28 07:05:15 -05:00
Ian Jackson f63c7c48af Rename onion-* cargo features to hs-* in tor-* crates
Fixes #756
2023-02-28 11:10:17 +00:00
eta 85ca3e41b9 Merge branch 'shadykaty-error-hint-v2' into 'main'
Create and use an ErrorHint type to report how to fix a problem.

Closes #579 and #578

See merge request tpo/core/arti!994
2023-02-07 16:32:10 +00:00
Nick Mathewson 8ee04ac203 Merge branch 'logs' into 'main'
Report causes of errors

Closes #680

See merge request tpo/core/arti!997
2023-02-01 18:19:33 +00:00
Nick Mathewson a2b1f20216 Bump minor version of tor-cell.
In !948 we renamed a couple of accessor functions, which is a
breaking change in `tor-cell`'s API.

In retrospect, perhaps we should have deprecated the old names and
added the new ones, so we wouldn't have to break the API.  (This is
the only API break AFAICT since 1.1.0.)
2023-02-01 10:42:58 -05:00
Nick Mathewson 7c1b6a5a81 Bump the patch version of every crate that had API additions
These crates had API or behavior changes that may affect downstream
crates. Fortunately, they're all version 0.x, and don't need minor
bumps for this.
2023-02-01 10:36:29 -05:00
Nick Mathewson 66f594a4b6 Bump the patch-level version of crates with _minor_ changes.
These changes influence behavior, but not effect compatibility.
(If I messed up, and any crate except for `arti` has non-breaking
API changes, that's still fine, since they are all version
0.x.)
2023-02-01 10:23:58 -05:00
Ian Jackson 5c0a7e0127 Use ErrorReport for errors in error! in arti-client 2023-01-30 18:52:32 +00:00
Nick Mathewson b3c963e7fa ErrorHint: Add a note about lowering the permissions hint 2023-01-27 11:56:53 -05:00
Nick Mathewson ae963e3c6b ErrorHint: use anonymize_home 2023-01-27 11:56:53 -05:00
Nick Mathewson 39ad97fdc2 ErrorHint: Implement tryfrom_torpersist 2023-01-27 11:56:53 -05:00
Nick Mathewson 3c82f794c1 ErrorHint: refactor API (part 2)
Change ErrorHint so that, internally, it just holds an enum with a
lightweight reference to whatever parts of the error it needs to
generate a hint.  Then we can move the formatting logic into a
Display function for ErrorHint, and do away with ErrorDetail entirely.
2023-01-27 11:56:53 -05:00
Nick Mathewson b8058c5d02 ErrorHint: refactor API (part 1)
Move the "hint" function into Error, and use Option rather than Result.

(I'm using Option here because it's not really an error case not to have
a hint; we just either have a hint, or we don't.)
2023-01-27 11:56:53 -05:00
Shady Katy cc4c07678a add opaque ErrorHint API, impl ErrorHint from BadPermissions 2023-01-27 11:02:42 -05:00
Nick Mathewson a6dd92843e Allow clippy::unchecked_duration_subtraction in tests
This panics on error, and we're fine with a panic on misbehavior in
tests.
2023-01-27 08:28:02 -05:00
Nick Mathewson bf04641c68 Disable clippy::unlinlined-format-args
This warning kind of snuck up on us! (See #748)  For now, let's
disable it.  (I've cleaned it up in a couple of examples, since
those are meant to be more idiomatic and user-facing.)

Closes #748.
2023-01-27 08:27:47 -05:00
Michael van Straten fa93f6674d made TorClient::set_stream_prefs public 2023-01-18 18:20:59 +01:00
Nick Mathewson 56cb2d2a10 Make a top-level API for connecting to onion services.
Fortunately, it adds very little to the arti-client API surface.
2023-01-12 09:28:58 -05:00
Ian Jackson 125a455bdc test lint blocks: Add many many automatically
This is precisely the result of running the rune in
maint/adhoc-add-lint-blocks.
2022-12-12 18:00:30 +00:00