Initial support for a native Tor proxy #670
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit implements native support for using Tor (i.e. not using an intermediate SOCKS5 connection) into Halloy, using Arti, the official Tor implementation in Rust.
It does so, by adding a third proxy type named
Tor
, that co-exists betweenSocks5
andHttp
. In order to achieve that change, a breaking change in the proxy syntax was necessary, as a native Tor proxy obviously does not need a host nor a port.With this change, configuring a proxy looks like this:
Besides this, it also wraps the internally used
TcpStream
data structure behind anIRCStream
enum which implements theAsyncRead
,AsyncWrite
andUnpin
traits and also wraps theDataStream
used by Tor into it.It remains an open question how good this implementation is. Personally, I am a bit afraid that it will leak at a few places, namely the checking for updates as well as the file transfer feature. Further evaluation is needed here.
Regarding the usefulness of the feature: Primarily I think that this is a neat addition by having a monolithic binary that uses Tor without depending on any other system resources. Besides this, it may even be possible to drop support for
Socks5
andHttp
proxies entirely if this feature matures even further, as Tor is basically the only reason why modern applications still include support forSocks5
(and maybeHttp
). Alongside it would probably also make Halloy the first IRC client ever with native Tor support. 🙂As a disclaimer: Professionally I am a part of the team responsible for developing Arti. This pull request is a personal project however which I develop entirely in my free time.