summaryrefslogtreecommitdiff
path: root/crates/arti/src/socks.rs
Commit message (Collapse)AuthorAgeFilesLines
* socks.rs: Update documentation; RpcDataStream has been renamed.Nick Mathewson2025-01-301-9/+5
|
* rpc: Correct API documentation about optimismNick Mathewson2025-01-301-2/+1
| | | | | | | | | | | Our documentation had dated to an older version of our RPC stream code, where all streams were automatically optimistic. But as explained, our use of "optimistic"ness in RPC stream code is now purely internal, to make it possible to get an DataStreamCtrl. This isn't user-visible in our rpc_conn_open_stream code. Closes #1583
* arti: Make Rpc argument unconditional when constructing socks proxyNick Mathewson2025-01-231-9/+6
| | | | | | Formerly this was a conditional method argument, which is a huge antipattern. Now it is unconditionally present, as `Option<T>` for a type that is uninhabited when RPC isn't supported.
* arti::socks: Re-wrap a section.Nick Mathewson2025-01-231-2/+3
| | | | | rust-analyzer keeps re-wrapping this piece for me, even though rustfmt doesn't complain.
* rpc: Rename new_stream_handle to new_oneshot_client.Nick Mathewson2025-01-151-1/+1
| | | | | | | | This method doesn't actually create a new stream; it creates a single-use client object that can be used with SOCKS to launch a new stream, and capture an RPC object for that stream. Closes #1664.
* fix: fix typosDimitris Apostolou2025-01-061-1/+1
|
* Replace references to prop351 with socks-extensions.mdNick Mathewson2024-10-021-7/+10
| | | | | | | Now that the proposal is implemented and merged into the specs, the proposal itself is only historical. Closes #1629.
* Merge branch 'rpc-doc-socks-objectid' into 'main'Nick Mathewson2024-10-021-0/+16
|\ | | | | | | | | Copy section on objectid/isolation restrictions from prop351. See merge request tpo/core/arti!2474
| * Copy section on objectid/isolation restrictions from prop351.Nick Mathewson2024-09-301-0/+16
| | | | | | | | | | Eventually it belongs in an RPC spec, but for now the relevant discussion goes here.
* | Merge branch 'socksproto-3' into 'main'Ian Jackson2024-10-011-61/+28
|\ \ | | | | | | | | | | | | | | | | | | New tor-socksproto API Closes #1627 See merge request tpo/core/arti!2436
| * | 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.
| * | arti SOCKS proxy: Defer splitting the socks streamIan Jackson2024-10-011-13/+13
| | | | | | | | | | | | This is neater, I think.
| * | arti SOCKS proxy: Reject pipelined client dataIan Jackson2024-10-011-1/+1
| | | | | | | | | | | | Fixes #1627 / TROVE-2024-010
| * | arti SOCKS proxy: Use new tor-socksproto APIIan Jackson2024-10-011-40/+17
| | | | | | | | | | | | No functional change.
| * | tor-socksproto: Move `handshake` to be a trait methodIan Jackson2024-10-011-1/+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-6/+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.
| * | Revert "arti SOCKS proxy: Tear down connections when client sends optimistic ↵Ian Jackson2024-10-011-5/+0
| |/ | | | | | | | | | | data" This reverts commit 87e0109832559dec41a485b268579d58be0de278.
* / arti: Warn when listening on non-loopback addresses.Nick Mathewson2024-09-251-0/+4
|/
* 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/+6
| | | | | | | | | 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.
* Merge branch 'impl-prop-351' into 'main'Nick Mathewson2024-09-241-124/+106
|\ | | | | | | | | socks: Implement proposal 351. See merge request tpo/core/arti!2401
| * socks: Add a comment about interpreting legacy usernames.Nick Mathewson2024-09-241-0/+5
| |
| * socks: cleanups in interpret_socks_authNick Mathewson2024-09-181-12/+22
| | | | | | | | Introduce an enum, and use explicit `format_code @` syntax.
| * prop351: comment Suggestions from @diziet.Nick Mathewson2024-09-181-1/+4
| |
| * Socks: isolate streams from different extended-socks formatsNick Mathewson2024-09-181-3/+16
| | | | | | | | | | | | | | (These streams would already be isolated by accident, since streams with an RPC object are always on a client that's isolated from the main client. But, as discussed on torspec!280, it's best to do this sort of thing explicitly.)
| * socks: Optimistically revise format to match torspec!280Nick Mathewson2024-09-101-43/+53
| |
| * socks: update protocol documentationNick Mathewson2024-09-091-78/+9
| | | | | | | | | | | | | | The current best source here is prop351, and later will be socks-extensions.md. The examples are now correct.
| * socks: Implement proposal 351.Nick Mathewson2024-09-091-40/+50
| | | | | | | | | | | | | | | | See https://spec.torproject.org/proposals/351-socks-auth-extensions.html This proposal changes the interpretation of SOCKS5 usernames/passwords to give a more principled and extensible way of getting RPC IDs and isolation strings.
* | Merge branch 'pessimistic' into 'main'Nick Mathewson2024-09-241-0/+5
|\ \ | | | | | | | | | | | | arti SOCKS proxy: Tear down connections when client sends optimistic data See merge request tpo/core/arti!2443
| * | arti SOCKS proxy: Tear down connections when client sends optimistic dataIan Jackson2024-09-241-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We *do* want to support optimistic data, see https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2436#note_3081886 However, right now, Arti risks mis-framing bugs if clients do send optimistic data, which would be quite serious. Mitigates #1627 / TROVE-2024-010 by replacing the misframing bug with connection failure. It doesn't seem so easy to write a test case for this.
* | | rtcompat: Rename TcpProvider to NetStreamProvider.Nick Mathewson2024-09-241-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | (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.)
* / Fix a typo in WRONG_PROTOCOL_PAYLOAD.Pier Angelo Vendrame2024-09-101-2/+3
|/
* socksproto: Add a const for suggested buffer length.Nick Mathewson2024-09-091-2/+2
| | | | | Ticket #1509 will probably get rid of this constant, but for now we may as well put it in one place.
* rpc: More specificity surrounding SOCKS-rpc integrationNick Mathewson2024-09-091-2/+25
|
* Suggestion about describing non-RPC behavior of SOCKS protocol from @diziet.Nick Mathewson2024-09-091-1/+3
|
* arti: Add a comment explaining how RPC and SOCKS interactNick Mathewson2024-09-091-0/+181
| | | | | | | | | This belongs in a spec, but adding things to a spec is slow and fraught. Instead we'll put it here for now and move it later. There are some XXXXs about "finalizing" the design that we need to resolve before we can merge !2373 and implement stream creation in `arti-rpc-client-core`.
* rpc: Try using postage::watch to initialize ProxyInfo.Nick Mathewson2024-08-281-6/+6
| | | | | (This is a bit trickier than I would like, but it ensures that we never return a "not initialized yet" code.)
* RPC: Add experimental method to list SOCKS proxies.Nick Mathewson2024-08-281-1/+25
| | | | | | | We'll need this for our rpc-library code to meaningfully open SOCKS connections. Closes #1523.
* RPC: Use RPC methods instead of the "ClientConnectionTarget" trait.Nick Mathewson2024-06-111-30/+9
| | | | | | | | | | | | On its own, this might not seem like a huge improvement, but it will later let us implement these RPC methods for types that can't reasonably implement ClientConnectionTarget. It also serves as a proof of concept that special-method invocation can actually work, so that we can build things like this in cases where introducing a trait isn't practical. Closes #1427
* rpc: Make RpcMgr::lookup_object return context along with object.Nick Mathewson2024-06-101-0/+1
| | | | The context will make it possible to invoke rpc methods.
* RPC: Use a slightly less awful workaround in socks.rsNick Mathewson2024-05-141-20/+34
| | | | | | | | | | | | | | | | | The problem was that Rust won't let us say ``` type ConnTarget<R> = Arc<dyn ClientConnectionTarget>; ``` because the R parameter wasn't used. Previously we solved this by using a macro instead of a type definition, which is ugly. I had been thinking previously I would need to declare some kind of additional wrapper type, and had shrunk from the verbosity. But @diziet pointed out that I could just use a 2-tuple unconditionally. It's still not beautiful, but it is less hideous than before.
* Remove excess indentation from last commit.Nick Mathewson2024-05-141-14/+11
| | | | (This is a separate commit to make the branch more readable)
* RPC: Refactor socks interpretation to remove stream id, add isolation.Nick Mathewson2024-05-141-41/+41
|
* RPC: Add a trait that can be the target of SOCKS requestsNick Mathewson2024-05-121-18/+34
| | | | | | | | | | | | (These will later become objects that can receive any application request, once we have HTTP connect.) For now, Session and TorClient implement this trait; but soon there will be a new type to hold on to the created DataStreamCtrl. There are some XXXXs here, marking code that is too ugly to live. I should fix it before I merge this branch.
* handle_socks_conn: update parameter name in doc commentJim Newsome2023-10-251-1/+1
|
* Treat only EAFNOSUPPORT as a warningJani Monoses2023-09-261-4/+6
|
* Handle address already in useJani Monoses2023-09-221-2/+2
|
* arti, tor-config: Allow listening on generic addresses for SOCKS and DNS.Jani Monoses2023-09-221-15/+22
|
* Throughout: Use *_report!() macros for reporting Errors.Nick Mathewson2023-07-071-3/+4
| | | | | | | | | | | | | | | 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.