Commit Graph

62 Commits

Author SHA1 Message Date
Nick Mathewson 2ddaaafafb tor-ptmgr: Fix fuzzer compilation.
Since we made the internals of the ptmgr protocol parser
conditionally private, we need to tell Cargo to build the fuzzer
with the `experimental-api` feature so that it can access them.
2023-03-13 07:28:55 -04: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 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 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 37edcd688a Use ErrorReport - run rustfmt
Split off for ease of review and possible rebase.
2023-01-30 18:52:32 +00:00
Ian Jackson e159bf57d2 Use ErrorReport for errors in error! in tor-ptmgr 2023-01-30 18:52:32 +00:00
Ian Jackson 2954568fae Use ErrorReport for errors in warn! in tor-ptmgr 2023-01-30 18:52:32 +00: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
Nick Mathewson 71dfaa3125 ptmgr: Add more logs when looking/creating a PT.
These are also based on temporary logs that I added locally while I
was hunting bugs.

Also part of #677.
2023-01-06 17:19:00 +00:00
Nick Mathewson 3eebe33678 ptmgr: Add more logging to IPC code.
This is based on logs that I added locally while I was trying to
debug some startup issues.  Hopefully they'll make things easier the
next time there's something to debug.

Part of #677.
2023-01-06 17:19:00 +00:00
Emil Engler 8579bc66a8
doc: consistent summary line for the READMEs
This commit introduces a consistency to the summary line of all
README.md files in each and every crate.
2022-12-20 14:31:47 +01:00
Dimitris Apostolou 7c1beb6171
Fix typos 2022-12-09 11:57:36 +02:00
Nick Mathewson 40941c6079 Merge branch 'version_bump' into 'main'
Bump the minor version of every crate.

See merge request tpo/core/arti!918
2022-11-30 20:54:15 +00:00
Nick Mathewson 38bef96b99 Bump the minor version of every crate.
We made this job easy this time around: by incrementing our MSRV, we
have forced ourselves to do at least a minor bump everywhere.
2022-11-30 15:10:16 -05:00
Nick Mathewson 82f877ec79 Hang onto a PT object after it is launched
If we don't do this, then snowflake's stdin will get closed and
it will exit immediately.

Found while investigating #333.
2022-11-30 14:44:14 -05:00
Ian Jackson fa676ce577 ptmgr todo: Remove dead code allow 2022-11-30 16:42:40 +00:00
Ian Jackson fe33112923 ptmgr: No need for state_dir in PtMgr
This is used exclusively by the reactor.
2022-11-30 16:42:18 +00:00
Ian Jackson 1521f63bf1 ptmgr todo: Tolerate exposing the Vec for now
We may want to change this later, but this API is in a low level
crate, so this isn't a blocker.
2022-11-30 16:40:45 +00:00
eta f122b4b1ee Merge branch 'no_empty_select' into 'main'
ptmgr: Do not construct an empty select_all future.

Closes #672 and #670

See merge request tpo/core/arti!907
2022-11-30 16:01:58 +00:00
Nick Mathewson d853fdb5cb ptmgr: Do not construct an empty select_all future.
Closes #670.

Closes #672.
2022-11-30 10:22:09 -05:00
Ian Jackson 1e63a89ce8 ptmgr: change error UnconfiguredTransportDueToConcurrentReconfiguration
Rename it from UnconfiguredTransport.  Change descriptions, kind, and
retry.  Add a TODO.

As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858455
2022-11-30 15:21:49 +00:00
Ian Jackson d705454313 ptmgr: Clarify E::NotAFile
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858454
2022-11-30 15:21:39 +00:00
Ian Jackson f19d8e0397 ptmgr: Fix kind for E::StatedirCreateFailed
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/901#note_2858456
2022-11-30 15:21:39 +00:00
Nick Mathewson dacb3eafda ptmgr: report an error if PT transports don't match requested.
(I think this may be impossible now, since we check in ipc.rs, but
IMO it's best to check.)
2022-11-29 20:01:19 -05:00
Nick Mathewson fdc49b1fed Register transport in pt reactor even if it has no pending requests 2022-11-29 19:35:38 -05:00
Nick Mathewson 9765fdc2e6 ptmgr: Use anonymize_home when displaying paths in errors 2022-11-29 19:30:50 -05:00
Nick Mathewson f6311c83f7 ptmgr: Use PluggableTransport::identity in logs.
This lets us avoid logging the user's path.
2022-11-29 19:20:44 -05:00
Nick Mathewson bb0749cd42 Centralize the "find an identifier for the pt name" logic in one place. 2022-11-29 19:13:32 -05:00
Nick Mathewson 21e7e52ad5 Merge remote-tracking branch 'eta/ptreactor-v1' into merge_ptreactor
Resolved several conflicts while doing so; mostly with !893 and
!895.
2022-11-29 18:55:49 -05:00
eta 9b4fc50625 tor-ptmgr: add PtReactor
This fleshes out the PtReactor that was previously a stub, making it
actually do reactor-ey things. Note that this is entirely untested, and
might not work at all. Hopefully it does, though.
2022-11-29 20:13:32 +00:00
Ian Jackson 211a832f6d Clarify internal error. 2022-11-29 17:22:16 +00:00
Nick Mathewson 75cba2ce80 ptmgr: Refine RetryTime for ChildSpawnFailed. 2022-11-29 10:44:09 -05:00
Nick Mathewson 29ea66ecb9 ptmgr: Rename ClientTransportFailed, document, and correct its RetryTime. 2022-11-29 10:42:26 -05:00
Nick Mathewson d9dc30bc13 ptmgr: Replace StdioUnavailable with a PtError. 2022-11-29 10:36:51 -05:00
Nick Mathewson 7f923b9dfe Rename LocalLoginFailed to ExternalToolFailed. 2022-11-29 10:32:59 -05:00
Nick Mathewson 820657b6bc PtMgr: Use a persistent state directory for PT state.
This makes a `pt_state` directory inside .local/share/arti (or the
local equivalent), right next to our existing `state` dir.

Ideally we would use a separate directory for each PT, but we have a
very fuzzy "what is a specific PT" notion.

Closes #667
2022-11-28 17:29:32 -05:00
Nick Mathewson 3fa86f41a6 Revise the API of "PtMgr::reconfigure"
I prefer that it not take `&mut self`, since PtMgr already has
interior mutability.

I also need it to take `tor_config::Reconfigure` argument, in case
it gains any more smarts about validation in the future.
2022-11-28 17:29:23 -05:00
Nick Mathewson c99017b0d6 ptmgr: Note a TODO issue around TempDir. 2022-11-28 17:29:23 -05:00
Nick Mathewson 4b5be3685f ptmgr: Fill in some error-related code; resolve TODOs. 2022-11-28 17:29:23 -05:00
Nick Mathewson 1fa9296f9c ptmgr: clear up unused_import exceptions. 2022-11-28 17:29:23 -05:00
Nick Mathewson 6bde90ce01 PtMgr: New features section in README.md
Per convention, have a `full` feature.

Also, downgrade the 'TODO pt-client' entries in README::limitations,
since they are not blockers for 1.1.0.
2022-11-28 17:29:23 -05:00
Nick Mathewson 8d0ac9bdc8 ptmgr: Mark PtMessage and next_message as experimental-api.
These are implementation details and we don't want to mark them as
stable.

To do this, I needed to apply some additional options to the example
code's configuration in Cargo.toml.
2022-11-28 17:29:23 -05:00
eta 3b41c78d6f Draft: Pluggable transport manager
This commit implements `PtMgr`, a pluggable transport manager
responsible for keeping track of spawned PTs and spawning them to
satisfy client requests on demand.

It does this in two parts: the `PtMgr` type exported to the rest of the
code, and the background `PtReactor` that actually does the spawning;
this design ensures that only one attempt to spawn a PT is active at a
time, and will prove useful later for implementing e.g. timeouts.

A few changes were necessary to the rest of the code in order to make
this all work out. Namely:
- `TransportRegistry`'s API didn't make any sense for two reasons:
  - It wasn't feasible for implementors to implement `ChannelFactory`,
    since that'd require constructing a `ChanBuilder` (which requires a
    bootstrap reporting event sender).
  - Treating the PT manager as a registry is over-general; it's only
    necessary for it to spawn pluggable transports, so saddling it with
    other concerns didn't make any sense.
  - (It's possible to get extensibility for arbitrary user customization
    by just letting the user swap in a new `ChannelFactory`, anyway.)
- Therefore, the `PtMgr` implements the new `AbstractPtMgr` trait, which
  is far more narrowly focused; this only exists to solve a dependency
  loop, and is documented as such.
  - This provides a `TransportHelper` instead of a `ChannelFactory`.
2022-11-28 13:52:21 -05:00
eta 2f75702cec Replace TransportRegistry with AbstractPtMgr
It doesn't make much sense to have the pluggable transport manager be a
registry, so replace its interface with a more narrowly defined, less generic
version.

Other changes:
- instead of returning a &-reference, it returns an owned Arc, which
  should make the ptmgr easier to implement while allowing efficient
  reuse
- provision for error handling is added, but will probably be revised in
  a future commit pending discussion
- tor-ptmgr code that would generate warnings as a result of this change
  is temporarily removed

This is a split out version of arti!886, intended so work on arti#659
can proceed.
2022-11-22 18:09:06 +00:00
eta 1c9f6fb179 tor-ptmgr: make configuration use builders, plumb into arti-client
This brings the draft configuration mechanisms in tor-ptmgr in line with
the config in other crates, using builders. It also plumbs the config
type through into the main `arti-client` config, and adds some example
lines to `arti-example-config.toml`.
2022-11-16 11:39:25 +00:00
Nick Mathewson 936920b26e bump rust-version to 1.60 in every crate. 2022-11-10 10:57:33 -05:00
Nick Mathewson 932fe48eaf Run add_warnings. 2022-11-03 11:06:02 -04:00
trinity-1686a d29f38603d set all crate edition to 2021 2022-11-01 00:17:33 +01:00