[tor-dev] funion: A Tor Client in Elixir

2023-09-21 Thread Emil Engler
Hello Tor hackers,
I just want to announce "funion", a Tor client implementation in Elixir
which has been my primary side-project from March 2023 to August 2023.

I began this project as an exercise in order to understand both, the Tor
protocol and Elixir, a little bit better.  Choosing Elixir came to my
mind after watching a Computerphile video[1] introducing Erlang.  After
watching it, I concluded that Tor's hierarchy of connections -> circuits
-> streams fits in very well -- which it actually does.

Currently, the implementation is capable of creating streams across
several hops with the ability of sending and receiving data.  The
implementation has a size of roughly 3500 LOC.  A very neat feature is
that each connection is a dedicated process having the circuits as
dedicated child processes and the streams as dedicated grandchild
processes respectively.  This design leads to some very nice benefits,
including the fact that only the circuit processes hold the
cryptographic keys used in communication (except the TLS keys).

Keep in mind however that it still lacks many features, most notably
support for the directory protocol, resulting in the necessity of
hard-coding each OR with the keys extracted manually from the consensus.
I am not sure if I will find the time to continue hacking on this
though, but it has been a very fun and refreshing experience so far.
The Elixir code might not be the most beautiful out there, as this was
my first project in this language.

I do not consider this to be anything near production ready.  Beside
this, I purposely decided to ignore certain practices common in
cryptographic applications (such as overwriting sensitive keys with
zeros) for the sake of simplicity, as my primary intention was to
understand the Tor protocol, not to write a tool that allows secure and
anonymous communication across the internet.  If you seriously depend on
anonymity: DO NOT USE THIS!

The repository can be found here: https://github.com/emilengler/funion

A talk given at BornHack 2023 talking about the internals and pitfalls
can be found here:
https://media.ccc.de/v/bornhack2023-56123-funion-a-tor-client-i

My dedications go to the following people who have helped me dealing
with understanding various internals of Tor, be it direct or indirect:
- Roger Dingledine
- Alexander Færøy
- Ian Jackson
- Nick Mathewson
- The Talla Authors
- trinity

[1]: https://www.youtube.com/watch?v=SOqQVoVai6s
___
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev


Re: [tor-dev] Is Arti expected to have better multi-CPU support than C-tor?

2023-03-08 Thread Emil Engler
On Wed, Mar 08, 2023 at 06:30:42AM -0500, Nick Mathewson wrote:
> That said, we have spent approximately zero time so far tuning this
> multithreading, and I'd be surprised if it scales perfectly the first
> time.

Somewhat related: Rust programs generally tend to have a better
performance than their C pedants if they really want to.  This is mainly
due to the fact, that crazy thread optimization can be done securly.

A prominent example is [fd](https://github.com/sharkdp/fd), which uses
multiple threads to traverse the file system, thereby being around 50%
faster than find(1).  Just the imagination of a parallel FS access in C
gives me nightmares. :^)

-- Emil
___
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev