No description
Find a file
Vincent Batts d04f36c78e
another thought
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-10-01 05:40:12 -04:00
README.md another thought 2018-10-01 05:40:12 -04:00

p2p-pastebin

An idea for easy and instant sharing of files.

Overview

bittorrent is an established protocol and there are public infrastructure available that can be leveraged.

Even though much of the torrent world tends to be long-living and eventually stale content. This idea would be more for one-time, short lived content. The *.torrent file is never even shared, only the magnet URI.

Ideally this could be a native binary to wrap the whole process. Until then, most of this workflow should be possible with transmission-cli utilities.

Like:

# get today's best trackers
curl https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt

# make the *.torrent
transmission-create -o dir.torrent -c "this is a test for creating magnets" -t "udp://62.138.0.158:6969/announce" -t "udp://185.225.17.100:1337/announce" -t "udp://51.15.4.13:1337/announce" dir/

# get the magnet URI to share
transmission-show -m ./dir.torrent

# start seeding the data
transmission-cli -er -w . ./dir.torrent

Then from the other host:

transmission-cli -w . "magnet:?xt=urn:btih:5c2a54edd30dbe87765dcc85a0e5b4f6f2e8780b&dn=dir&tr=udp%3A%2F%2F62.138.0.158%3A6969%2Fannounce&tr=udp%3A%2F%2F185.225.17.100%3A1337%2Fannounce&tr=udp%3A%2F%2F51.15.4.13%3A1337%2Fannounce"

signalling all-done

Only particularly tricky aspect is how to signal from all the clients that have been shared the magnet, that they are done. Or further, to expire the shared data. One of the primitives forced by the bittorrent protocol is that the data is effectively permenantly available as long as someone is still sharing it (seeding).

libraries

There are some good client libraries in golang that cover much, but lack the building of the torrent and then producing the magnet URI. Like github.com/anacrolix/torrent [godoc] has everything to recieve the magnet string and start downloading the shared data.

Looking at the ./cmd/... tools provided by this library it looks like it may have everything needed to accomplish this workflow I'm imagining (except expiration of the content).

Reference