Building a BitTorrent client from the ground up in Go (2020)
blog.jse.li
blog.jse.li
DHT is required when your torrent file does not contain any tracker URLs (and you didn't add any yourself). In this case if it's blocked, then you have a problem.
Private trackers typically disable DHT for all torrents (so their torrents don't leak to outside users), along with PEX. It's just a flag in the torrent file, so you can force-enable it if you want (but it won't help much since the vast majority of other peers will probably abide by the rules).
To quote Satoshi Nakamoto, "For transferable proof of work tokens to have value, they must have monetary value. To have monetary value, they must be transferred within a very large network – for example a file trading network akin to bittorrent."
I was also saddened by AWS dropping torrent support from their S3 API because that's one more easy way that folks could provide torrent bootstrapping "for free"
Decentralization is just a buzz-word added to keep the privacy fundamentalists interested.
One nit, with the font:
l4:spami7ee
the first two characters look an awful lot like the number "14", when they're actually "L4". I'm not sure if bencoding is case sensitive or if anohter font may better differentiate the two, but that may be something the author may want to poke at if they happen to read this comment :)Reading the next example, showing an encoded dictionary, was what made the penny drop. Bencode doesn't go out of its way to be visually accessible, so different font choices would help.
What is the purpose of that choke part when connecting to remote peers? Is that some kind of flood protection?
Anyway it's a cool post! Would be nice to see a follow-up for the upload/sharing part!
That code is only downloading, as far as I can tell. Never sharing the file. I was just asking if that's tolerated in BitTorrent. My guess was that it is not.
Well the point of peer to peer is that peers share while they download. Otherwise, if everyone only downloads, then it doesn't really get distributed. Also I meant client/server in opposition to p2p. Many non-p2p systems "on the cloud" spread the load and downtime risk across machines, that is independent from the p2p part.
> using BT to download, but then exiting without attempting to seed anything
I am not saying that you should keep sharing after it is downloaded. But typically BT clients "force" you to share while downloading.
> And the reason I mentioned the "ratio currency" is your use of the word "tolerated" here: BitTorrent isn't the mafia, it's just a protocol that offers the ability to share pieces back to the Internet.
Sure, sorry for my english, not my mothertongue :-). I know it is not the mafia, and I know it is a protocol. I used the word "tolerated" to ask whether or not, in practice, that gets you banned.
As for your question of "Is that tolerated?" the question is a social one. As the sibling commenter pointed out, if you use a private tracker, you're part of a community that often has a social contract (implicit or explicit) that participation means you need to contribute back and have a good seeding ratio. In that case, only downloading -- like my client does -- is not tolerated and might get you banned. That's why I chose to demo with torrenting a Linux ISO, since those tend to be public, have a lot of seeders anyway, and don't really care how much you upload or download.
There's nothing in the protocol that says you have to do it, and indeed, there are even "selfish" algorithms that try to maximize download speed while uploading nothing in return: https://www.wired.com/2007/01/bittorrent-bullies-bittyrant-a...
And it changes from all those Twitter-related posts recently, to be honest :-).
You only need hole punching if both peers are behind a NAT (TCP hole punching is substantially more complex and fragile than UDP). You can reduce the need for hole punching if you complicate the signaling protocol (eg "please dial me at <addr>").
That said, bittorrent is quite resilient to NATs in practice, because since it's many-to-many, chances are even NATed clients will find many non-NATed clients.