Skip to content

Draft: New tor-socksproto API

Ian Jackson requested to merge Diziet/arti:socksproto-3 into main

Introduce a new API for tor-socksproto. It has basically the same approach: you call a function which tells you whether it wants to read or write, etc. But the new API is more ergonomic and also helps defend against various possible bugs.

The API was prompted by a feature the RPC client wanted (#1592) and a general desire to make things better (#1590), but it seems to have proved its value - trying to convert crates/arti to the new scheme revealed a bug: TROVE-2024-010 aka #1627.

The branch structure is as follows:

  • Minor fixes and prep work in safelog and tor-bytes
  • Initial refactoring.
  • Introduce an internal API, which the client.rs and proxy.rs files use, and gradually centralise various logic into it
  • Introduce the new external API and its tests
  • Replace uses of the old external API in arti, arti-rpc-client-core, and chanmgr
  • Deprecate the old API

The new API is roughly as sketched in #1590 (comment 3076665) but the names and details are different.

Fixes #1627 (TROVE-2024-010) #1590 #1592

CC @nickm

Merge request reports