aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src/transport/proxied.rs
Commit message (Collapse)AuthorAgeFilesLines
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-rtcompat+misc: add `NetStreamProvider::ConnectOptions`Steven Engler2026-06-081-1/+3
| | | | | | | | | This adds the trait type `ConnectOptions` to `NetStreamProvider` and adds this `ConnectOptions` as an argument to `NetStreamProvider::connect()`. You probably want to look at the changes in tor-rtcompat first, then the rest of this commit is updating the various places we use `NetStreamProvider`.
* tor-chanmgr: fix `unused_imports` warningSteven Engler2026-05-271-1/+3
|
* chanmgr: report target address, not proxy address, in errorNick Mathewson2026-05-071-2/+2
| | | | | | Also, change the address type in the error to String for now. In reality we need a better representation of this error, but that shouldn't block this.
* chanmgr: refactor error typesNick Mathewson2026-05-071-2/+8
| | | | | Proxy belonged as a subcase of ChannelBuild. And ChannelBuild was only about making an initial connection.
* tor-chanmgr: add loopback validation, startup warning and httparseNihal2026-03-181-95/+116
|
* tor-chanmgr: split handshake into helper functionsNihal2026-03-181-14/+47
|
* tor-chanmgr: fix type inference in handshakeNihal2026-03-181-1/+1
|
* tor-chanmgr: refactor handshake into helper functionsNihal2026-03-181-30/+53
|
* tor-chanmgr: implement HTTP CONNECT proxy handshake and wire transportNihal2026-03-181-14/+162
|
* proto: Use the PeerAddr accross channel handshakeDavid Goulet2026-02-191-8/+6
| | | | | | | This is a large change but it is basically using PeerAddr in the channel builder through the channel handshake code and into the Channel itself. Signed-off-by: David Goulet <[email protected]>
* tor-chanmgr: fix proxy config parsing and clippy lintNihal2026-02-161-1/+1
|
* tor-chanmgr: remove SocketAddr and improve errorNihal2026-02-161-1/+1
|
* tor-chanmgr: add From<ProxyError> for io::Error conversionNihal2026-02-161-0/+6
|
* Remove unnecessary `doc(cfg(...))` attributesNeel Chauhan2025-12-041-2/+0
| | | | | | | | | Fixes part of #2193. (Edits from nickm: I selected the cases here that I could verify were correct from immediate context.) Edited-by: Nick Mathewson <[email protected]>
* 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-10/+7
| | | | | | | | | | | | | | 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.
* tor-socksproto: Handle 0-byte reads (EOF) correctlyIan Jackson2024-10-011-1/+1
| | | | | | | This restores the functionality of socks users: detect closed sockets. 0c595818f713916d94b7b0e4062f953fad7c9799 which we reverted as part of rebasing this branch onto main.
* tor-chanmgr: Use new tor-socksproto API (fmt)Ian Jackson2024-10-011-2/+1
|
* tor-chanmgr: Use new tor-socksproto APIIan Jackson2024-10-011-56/+16
|
* Apply deferred rustfmt churnIan Jackson2024-10-011-3/+2
|
* tor-socksproto: Move `handshake` to be a trait methodIan Jackson2024-10-011-0/+1
| | | | | | | | | | | This deduplicates some docs and eliminates the two wrapper functiosn for `run_handshake`, which is now just `handshake`. We're going to make other API breaks too, and this isn't going to be the primary API, so we might as well do this. Proper description of the semver breakage will come at the end when it's all done.
* Revert "socks users: detect closed sockets."Ian Jackson2024-10-011-11/+1
| | | | This reverts commit 0c595818f713916d94b7b0e4062f953fad7c9799.
* Revert "socks users: copy the correct amount in our drain logic."Ian Jackson2024-10-011-1/+1
| | | | This reverts commit dceeb82f7d1154894ab9c7c607d68f8335bb9615.
* socks users: copy the correct amount in our drain logic.Nick Mathewson2024-09-241-1/+1
| | | | | | | | When calling copy_within, we want to copy the amount of data that we're keeping; previously, we were copying an extra `action.drain` bytes, which could have led to a panic. Spotted by Opara.
* socks users: detect closed sockets.Nick Mathewson2024-09-241-1/+11
| | | | | | | | | Without this check, our socks code can enter an infinite loop if a socket is closed at the wrong time. Resolves TROVE-2024-011. Fixes #1635.
* rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-7/+7
| | | | | | | | | | | | | | (And similarly rename TcpListener to NetStreamListener, along with their TcpStream/TcpListener associated types.) These types are about to become generic over addresses, and therefore shouldn't be named after TCP. Renaming was done mostly with Rust Analyzer, except for some macros that needed to be hand-edited. (I'll revise the comments in the next commit; this one is all about renaming.)
* socksproto: Add a const for suggested buffer length.Nick Mathewson2024-09-091-1/+2
| | | | | Ticket #1509 will probably get rid of this constant, but for now we may as well put it in one place.
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* Add initial support for running a PT in server modeSaksham Mittal2023-08-241-2/+2
|
* 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
|
* Fix a local-only CPU DoS bug.Nick Mathewson2023-05-231-0/+15
| | | | | | | | | | | | | | | | | | Previously, there was a bug in the way that our code used our SOCKS implementations. If the buffer used for a SOCKS handshake became full without completing the handshake, then rather than expanding the buffer or closing the connection, our code would keep trying to read into the zero-byte slice available in the full buffer forever, in a tight loop. We're classifying this as a LOW-severity issue, since it is only exploitable by pluggable transports (which are trusted) and by local applications with access to the SOCKS port. Closes #861. Fixes TROVE-2023-001. Reported-By: Jakob Lell <jakob AT srlabs DOT de>
* s/ProtocolFailed/ProtocolViolation/g where possibleNeel Chauhan2023-04-081-1/+1
|
* 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.
* chanmgr: trace-level logs when launching connections.Nick Mathewson2023-01-061-0/+12
| | | | Based on more temporary debugging code. Yet another part of #677.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+8
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* Rename TransportHelper => TransportImplHelper.Nick Mathewson2022-11-301-2/+2
|
* Merge branch 'bridge-addr-2' into 'main'Nick Mathewson2022-11-301-5/+5
|\ | | | | | | | | Separate BridgeAddr and PtTargetAddr See merge request tpo/core/arti!904
| * Separate BridgeAddr and PtTargetAddrIan Jackson2022-11-301-5/+5
| | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/668#note_2858220 This commit is difficult to split up. The innards of BridgeAddr and PtTargetAddr are still a bit entangled.
* | PT protocol: pt-spec conformance with password fieldNick Mathewson2022-11-301-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | pt-spec says: ``` If the encoded argument list is less than 255 bytes in length, the "PLEN" field must be set to "1" and the "PASSWD" field must contain a single NUL character. ``` This is a very silly thing to say, but some PTs enforce it. Fixes #676.
* | connect_via_proxy: Actually send initial handshake.Nick Mathewson2022-11-301-3/+3
| | | | | | | | | | | | | | Our previous code would make a TCP connection to the proxy, then wait forever for it to say something. Whoops! Part of a fix for #676.
* | PT SOCKS tests: add a few more testsIan Jackson2022-11-301-1/+6
| |
* | PT SOCKS tests: test name that only fits in V4Ian Jackson2022-11-301-3/+7
|/
* Merge branch 'todos-chanmgr' into 'main'Nick Mathewson2022-11-291-5/+11
|\ | | | | | | | | chanmgr: resolve several remaining "TODO pt-client" issues See merge request tpo/core/arti!897
| * chanmgr: Distinguish failure to connect to proxy from other IO failuresNick Mathewson2022-11-291-5/+11
| |
* | Remove deprecated aliases in tor-linkspec.Nick Mathewson2022-11-291-5/+5
|/
* Draft: Pluggable transport managereta2022-11-281-13/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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`.
* Make ChannelMethod non-exhaustiveIan Jackson2022-11-241-0/+6
| | | | | | | | | Enums with variants conditional on cargo features must be non-exhaustive, because cargo features are supposed to be additive, meaning that enabling a feature (which might happen due to some random distant thing) ought not to break things using that enum. There were surprisingly few places to fix this.
* tor-chanmgr: Suppress an unused imports warning for `use super::*`Ian Jackson2022-10-211-0/+1
| | | | | If pt-client is disabled, there are in fact no tests, so the module is empty. But we would always want `use super::*` here.