initial commit

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2018-10-01 05:19:33 -04:00
commit a5870f6408
Signed by: vbatts
GPG key ID: 10937E57733F1362

57
README.md Normal file
View file

@ -0,0 +1,57 @@
# 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:
```shell
# 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:
```shell
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`](https://github.com/anacrolix/torrent)
[[godoc]](https://godoc.org/github.com/anacrolix/torrent) has everything to
recieve the magnet string and start downloading the shared data.
## Reference
* [automated list of trackers](https://github.com/ngosang/trackerslist)
* [golang torrent tracker implementation](https://github.com/crosbymichael/tracker) that has bencode logic too?
* [golang client library](https://github.com/anacrolix/torrent)