Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for a native Tor proxy #670

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cvengler
Copy link

@cvengler cvengler commented Dec 9, 2024

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 between Socks5 and Http. 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:

[proxy]
Http = { host = "127.0.0.1", port = 9150 }
Socks5 = { host = "127.0.0.1", port = 9150 }
Tor = {}

Besides this, it also wraps the internally used TcpStream data structure behind an IRCStream enum which implements the AsyncRead, AsyncWrite and Unpin traits and also wraps the DataStream 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 and Http proxies entirely if this feature matures even further, as Tor is basically the only reason why modern applications still include support for Socks5 (and maybe Http). 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.

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
between `Socks5` and `Http`.  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:
```toml
[proxy]
Http = { host = "127.0.0.1", port = 9150 }
Socks5 = { host = "127.0.0.1", port = 9150 }
Tor = {}
```

Besides this, it also wraps the internally used `TcpStream` data
structure behind an `IRCStream` enum which implements the `AsyncRead`,
`AsyncWrite` and `Unpin` traits and also wraps the `DataStream` 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` and `Http` proxies entirely if
this feature matures even further, as Tor is basically the only reason
why modern applications still include support for `Socks5` (and maybe
`Http`).  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.
@cvengler
Copy link
Author

cvengler commented Dec 9, 2024

It might also be a worthy discussion whether we should disallow plain-text IRC when having the Tor proxy defined, as using a plain-text protocol over Tor is obviously a huge compromise of privacy.

@casperstorm casperstorm requested a review from tarkah December 11, 2024 10:43
@casperstorm
Copy link
Member

Thanks for this PR! Will take a look at this during this week <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants