
Show HN: Synapse, a full featured BitTorrent client in Rust - Luminarys
https://github.com/Luminarys/synapse
======
kibwen
Not that I'm not always eager to see something get _rewritten in Rust_ , but
I'm curious whether web browsers have advanced to the point where a bittorrent
client could exist as a webapp rather than requiring native installation.
Could the bittorrent protocol operate over WebRTC?

~~~
ddevault
Synapse is not designed for people who want this use-case. It's primarily
designed for seedbox users who want a daemon to control remotely. It's also
designed to efficiently work at scale, and takes advantage of native features
like mmap to download quickly.

Also, it wasn't rewritten in Rust from some other language, it was written in
Rust in the first place.

~~~
matheusmoreira
How does mmap improve download speed?

~~~
atomashpolskiy
Not the author, but I think that the point is to make disk I/O async with
respect to requesting and receiving blocks. I.e. request for the next block
does not wait for the write of the previous block to complete.

~~~
loeg
And this makes sense when disk is slow and you have much more RAM than network
traffic. If RAM is small, while net traffic and disk are both fast, mmap
writes may result in poor file layout due to arbitrary OS flush order.

------
black_puppydog
So, if I understand this correctly, Rust would be a good fit for bittorrent,
right? Handling lots of stuff simultaneously, peers, trackers etc, to me a
bittorrent that actually does more than download and quit always seems like
something quite heavy...

~~~
Sir_Cmpwn
>a bittorrent that actually does more than download and quit always seems like
something quite heavy...

Don't forget to seed!

~~~
kibwen
Let's brainstorm ways to solve the seeders/leechers problem via
cryptocurrency: how much would it cost to encode a complete feature-length
film in the bitcoin blockchain? :P

~~~
blasdel
Bram Cohen built MojoNation which was the first real cryptotoken/smartcontract
startup

After that failed he designed BitTorrent to actually align the incentives of
users, without any of the currency bullshit getting in the way

------
josteink
For automation software, transmission (BitTorrent-client written in python,
slow) seems to be the standard.

If it could offer a transmission-compatible API-layer, I bet it would receive
much more interest.

Edit: apparently not written in python. My bad.

~~~
sanxiyn
Your wish is satisfied:
[https://github.com/SirCmpwn/broca](https://github.com/SirCmpwn/broca)

~~~
josteink
Nice. Appreciated. Now I clearly have a weekend project.

(Also, what great irony this proxy is written in python, eh?)

~~~
Sir_Cmpwn
>(Also, what great irony this proxy is written in python, eh?)

It's written by a different person (me). Also Transmission is written in C FYI

~~~
josteink
Yes. That was what was ironic since I (wrongly) complained about slow python
based software.

~~~
swinglock
The first implementation of BitTorrent was written in Python. I don't think it
has happened once since, not as any serious attempt anyway.

The clients that use Python today are not slow because they all use rasterbar-
libtorrent as a C Python module that performs all of the heavy lifting.

------
aw3c2
It would be great to have a client that works well for seeding massive amounts
of torrents (100,000+) on weak hardware (like a Raspberry). The main problem
seems to be memory usage.

How is the memory usage of this one?

It says it is light-weight. What kind of light-weight is it and are there some
metrics?

~~~
shadeslayer
Even if you solve the memory issues you will still be constrained by the NIC.

Most of these SBC's run ethernet over USB, so the performance is still going
to be shit.

~~~
andromeduck
Probably still good enough to saturate the typical American broadband
connection though.

------
atomashpolskiy
Awesome work, congrats!

------
floatboth
Unfortunate name clash ([https://github.com/matrix-
org/synapse](https://github.com/matrix-org/synapse))

~~~
kibwen
Someone ought to write a website that scrapes popular OSS hosting sites and
package repositories and comes up with a list of English words that _haven 't_
been taken already. :P

~~~
xtagon
Make it, and then name this app "Dictionary" :P

------
stuaxo
Interesting ! I tried integrating transmission for downloading content in a
video wall app and it was a bit of a nightmare.

Hopefully this will be better - please have a sane remote API.

One thing that Azeurus did really well, that transmission really did not -

You could can tell azeurus to re-check all the files that are there so it can
find out how far it's got.

In Azeurus I used this to reconstruct a large torrent by adding files that I
found, then telling it to re-check.

Transmission couldn't even tell if the files the torrent pointed at had been
deleted from under it.

~~~
Sir_Cmpwn
>please have a sane remote API

[https://github.com/Luminarys/synapse/blob/master/doc/RPC](https://github.com/Luminarys/synapse/blob/master/doc/RPC)

Pretty much all torrent clients can recheck the files.

------
mitchtbaum
> in Rust

Saying what language a program uses only describes its grammar and runtime.
Saying what dialect a program uses also describes its idioms.

[https://en.wikipedia.org/wiki/Programming_idiom](https://en.wikipedia.org/wiki/Programming_idiom)

For (a simple) example, actix-web uses actix, a library that largely changes
the nature of writing Rust code. This might be called Rust-a or Rust', or
something.

[https://github.com/actix/actix-web](https://github.com/actix/actix-web)

My point is that Rust is a really cool language where "the(/some)
(sub)community(ies)" are developing and coalescing around great libraries
outside of core std, making a very* robust language, or rather robust language
dialect.

~~~
chc
I'm not all that familiar with actix, but surely not every Rust program is
written using a library that largely changes the nature of Rust code. Like,
would you say there's a name for the dialect this program is written in?

~~~
mitchtbaum
Programming dialects don't seem to get names. I think a pattern of [language-
name]-[dominant-principles] might make a good name scheme. Suffixes would then
work across languages. Other suffix namespaces could coexist, though I'm not
sure what they'd be.

My point wasn't so much about any one program, so much as it was about an
invisible programming ethnology. I like when Show HNs say what language they
speak; I would like even more if they say how they speak it.

Having name for program dialects would allow prospective users and
contributors to gain deep insight about its intended structure, vision, scope,
limits, etc, etc, etc, etc from a distance.

It may have seemed narrow focused, but I didn't want my point to be limited to
one set of principles, patterns, and libraries, even though I like what actix
adds to Rust-std(?), especially since any code spoken in it can itself make,
or through some elements factored out be made into, other libraries that then
build on or toward another powerful dialect / speaker communities.

#hashtag: ethnocodology(?) ..ethnokodikology?

