summaryrefslogtreecommitdiff
path: root/crates/tor-ptmgr/src/ipc.rs
Commit message (Collapse)AuthorAgeFilesLines
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-3/+3
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+1
| | | | | | | | | | | | | Apparently clippy nightly is better (or worse?) about detecting complex functions than before, so I'm suppressing these warnings where they occur. I have mixed feelings about these warnings: On the plus side, they really do help to detect functions that are twistier than they need to be. On the minus side, they get confused by tracing macros, and the "allows" do pile up. But on the plus side, those "allows" do provide a way to find functions that need to be refactored, and they are never uglier than the functions they decorate.
* Use mpsc_channel_no_memquota next to a TODOIan Jackson2024-10-151-3/+2
| | | | We have a ticket for this. But the ticket number was wrong, so fix that.
* memquota: Note a TODO about PT channelsIan Jackson2024-10-021-0/+1
|
* ptmgr: Forbid managed pts on non-localhostNick Mathewson2024-09-251-0/+7
|
* tor-ptmgr: moved `PtClientMethod` from ipc to crate moduleSteven Engler2024-08-201-21/+1
|
* tor-ptmgr: move some code to a new 'managed' moduleSteven Engler2024-08-201-1/+1
| | | | | | Code that's related to managed transports has been moved to a new 'managed' module. This includes the PT reactor since it's not needed for unmanaged transports.
* Add test for PtStatus containing TRANSPORT field.Alexander Færøy2024-08-011-0/+10
| | | | See: tpo/core/arti#1488.
* Don't require TRANSPORT for PT STATUS messages.Alexander Færøy2024-08-011-18/+4
| | | | | | | | | | | | | | | This patch changes the PT STATUS handler to not require the presence of the `TRANSPORT` field in the K/V line. This matches current behaviour of C Tor and was requested by the Anti-censorship Team at an earlier point to enable STATUS messages to work for situation where it's not transport specific messages. To avoid future issues, we simply ignore any required keys right now even though TYPE is to be expected. See: tpo/core/torspec#267 See: tpo/core/torspec!63 See: tpo/core/arti#1488
* Merge branch 'encapsulate_config_rs' into 'main'Nick Mathewson2024-03-131-1/+1
|\ | | | | | | | | Encapsulate usage of config-rs inside tor-config. See merge request tpo/core/arti!2040
| * ptmgr: Use Itertools directly.Nick Mathewson2024-03-131-1/+1
| | | | | | | | Previously it used tor_config::Itertools, which is silly.
* | Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|/
* Use tor_basic_utils::PathExt::display_lossyIan Jackson2024-03-051-1/+2
| | | | | Change Path::display to this new function, in call sites where it's being used for a diagnostic.
* Merge branch 'todo-not-hss' into 'main'Alexander Færøy2023-10-221-1/+1
|\ | | | | | | | | Remove an "HSS" from a "TODO HSS" comment in ptmgr See merge request tpo/core/arti!1676
| * Remove an "HSS" from a "TODO HSS" comment in ptmgrNick Mathewson2023-10-161-1/+1
| | | | | | | | This isn't actually onion service related, AFAICT.
* | tor-ptmgr: Handle unsupported escapesEmil Engler2023-10-171-1/+8
|/
* Resolve ClientTransportLaunched and ServerTransportLaunched in different armsSaksham Mittal2023-09-131-24/+26
|
* Rename ClientTransportGaveError to TransportGaveErrorSaksham Mittal2023-09-131-1/+1
|
* Deduplicate ClientTransportLaunched and ServerTransportLaunchedSaksham Mittal2023-09-111-106/+135
| | | | | | | Note: this isn't perfect, though it moves both match arms to try_match_common_messages, it does end up resolving them separately using a helper function, and also necessitated creating another function in the PluggableTransportPrivate trait
* Deduplicate ClientTransportFailed and ServerTransportFailedSaksham Mittal2023-09-111-22/+11
|
* Import sealed module to avoid syntactic vinegarSaksham Mittal2023-09-111-14/+15
|
* tor-ptmgr: Test for empty valuesEmil Engler2023-09-071-0/+7
| | | | | | | This commit adds a unit test that checks if an empty value is parsed properly. It fixes the coverage in `crates/tor-ptmgr/src/ipc.rs:120`.
* tor-ptmgr: Test for missing valuesEmil Engler2023-09-071-0/+6
| | | | | This commit adds a test which checks for a missing value in an SMETHOD argument.
* tor-ptmgr: Test for forbidden `=`Emil Engler2023-09-071-0/+6
| | | | | This commit adds a unit test to the `tor-ptmgr` crate, which checks for forbidden `=` signs while reading a value.
* tor-ptmgr: Test argument ending with backslashEmil Engler2023-09-071-0/+6
| | | | | This commit adds a unit test to the `tor-ptmgr` crate, which checks if arguments are terminated with a backslash, which is forbidden.
* tor-ptmgr: Test unsupported octal sequencesEmil Engler2023-09-071-0/+9
| | | | | This commit adds a unit test that checks if all octal escape sequences are treated as an unsupported error.
* tor-ptmgr: Test escape sequencesEmil Engler2023-09-071-0/+8
| | | | | This commit adds a test to the `tor-ptmgr` crate, which increases the test coverage by checking for escape sequences in values.
* Add cognitive-complexity exceptions for clippy.Nick Mathewson2023-09-051-0/+2
| | | | I have no idea why these became necessary.
* Add initial support for running a PT in server modeSaksham Mittal2023-08-241-291/+620
|
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-7/+3
| | | | | | | | | | | | | | | I identified the cases to replace by searching for the string `.report()`. There are a few that I didn't change: * A couple of cases that used anyhow::Error, * One case that reported two Errors. * Two cases in `tor_hsclient::err` that just did `error!("Bug: {}")`. I have also not audited the cases in `tor-hsclient` where we're using `tor_error::Report` manually. Nonetheless, closes #949.
* Use ErrorReport - run rustfmtIan Jackson2023-01-301-1/+5
| | | | Split off for ease of review and possible rebase.
* Use ErrorReport for errors in warn! in tor-ptmgrIan Jackson2023-01-301-3/+3
|
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* ptmgr: Add more logging to IPC code.Nick Mathewson2023-01-061-9/+34
| | | | | | | | 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.
* ptmgr: report an error if PT transports don't match requested.Nick Mathewson2022-11-291-1/+0
| | | | | (I think this may be impossible now, since we check in ipc.rs, but IMO it's best to check.)
* ptmgr: Use PluggableTransport::identity in logs.Nick Mathewson2022-11-291-0/+8
| | | | This lets us avoid logging the user's path.
* Centralize the "find an identifier for the pt name" logic in one place.Nick Mathewson2022-11-291-5/+1
|
* Merge remote-tracking branch 'eta/ptreactor-v1' into merge_ptreactorNick Mathewson2022-11-291-16/+24
|\ | | | | | | | | Resolved several conflicts while doing so; mostly with !893 and !895.
| * tor-ptmgr: add PtReactoreta2022-11-291-14/+25
| | | | | | | | | | | | 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.
* | Clarify internal error.Ian Jackson2022-11-291-2/+2
| |
* | ptmgr: Rename ClientTransportFailed, document, and correct its RetryTime.Nick Mathewson2022-11-291-1/+1
| |
* | ptmgr: Replace StdioUnavailable with a PtError.Nick Mathewson2022-11-291-4/+12
|/
* ptmgr: clear up unused_import exceptions.Nick Mathewson2022-11-281-0/+6
|
* ptmgr: Mark PtMessage and next_message as experimental-api.Nick Mathewson2022-11-281-3/+4
| | | | | | | | 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.
* Draft: Pluggable transport managereta2022-11-281-10/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* ptmgr::ipc: Try an alternate approach to initial quotes.Nick Mathewson2022-10-261-10/+5
| | | | This lets us use `chars()` rather than `char_indices()`.
* tor-ptmgr/ipc: First cut of pluggable transport spawningeta2022-10-261-0/+856
The new `ipc` module inside `tor-ptmgr` implements the Pluggable Transport Specification version 1 (`pt-spec.txt`, https://gitlab.torproject.org/tpo/core/torspec/-/blob/main/pt-spec.txt). This enables module users to spawn pluggable transport binaries inside a child process asynchronously, and receive structured information about how to connect to the transports provided by said binaries. Internally, this is structured as a pure set of serialisers and deserialisers for the protocol in the specification (in the form of environment variables, and the PT's stdout), a wrapper to run the PT binary and enable accessing its output asynchronously, and a user-facing wrapper that handles ensuring all the requested transports launched properly. The included `run-pt` example is an exceedingly minimal wrapper program that was useful in testing. More tests can and should be added in a further MR. closes arti#394; part of arti#69