{"id":19174582,"url":"https://github.com/equalitie/btdht","last_synced_at":"2025-05-07T18:20:52.453Z","repository":{"id":66643030,"uuid":"419733749","full_name":"equalitie/btdht","owner":"equalitie","description":"Standalone bittorrent DHT library for rust","archived":false,"fork":false,"pushed_at":"2025-01-15T12:45:09.000Z","size":1449,"stargazers_count":31,"open_issues_count":6,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-20T01:33:00.334Z","etag":null,"topics":["bittorrent","dht","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/equalitie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-21T13:26:30.000Z","updated_at":"2025-01-24T22:55:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"a1d6ec25-1514-401a-ab33-b6e391c4d16d","html_url":"https://github.com/equalitie/btdht","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fbtdht","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fbtdht/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fbtdht/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fbtdht/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/equalitie","download_url":"https://codeload.github.com/equalitie/btdht/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252931812,"owners_count":21827170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bittorrent","dht","rust"],"created_at":"2024-11-09T10:18:24.707Z","updated_at":"2025-05-07T18:20:52.424Z","avatar_url":"https://github.com/equalitie.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bittorrent Mainline DHT (btdht)\n\nImplementation of the bittorrent mainline dht. Originally foked from [bip-rs](https://github.com/GGist/bip-rs)\n\n## References\n\n- [DHT Protocol](https://www.bittorrent.org/beps/bep_0005.html)\n- [DHT Extensions for IPv6](https://www.bittorrent.org/beps/bep_0032.html)\n\n## Terminology\n\n**Lookup**: Refers to the process of iteratively querying peers in the DHT to see if they have contact information for other peers\nthat have announced themselves for a given info hash.\n\n**Announce**: Refers to the process of querying peers in the DHT, and telling the closest few nodes that you are interested in peers\nlooking for a particular info hash, and that the node should store your contact information for later nodes that reach any of the nodes\nannounced to.\n\n## Important Usage Information\n- **Before The Bootstrap**: It is always a good idea to start up the DHT ahead of time if you know you will need it later in your\napplication. This is because the DHT will not immediately be usable by us until bootstrapping has completed, you can feel free to\nmake requests, but they will be executed after the bootstrap has finished (which may take up to 30 seconds).\n\n- **Announce Expire**: Nodes in the DHT will expire the contact information for announces that have gone stale (havent heard from again\nfor a while). This means if you are still looking for peers, you will want to announce periodically. All nodes have different expire\ntimes, the spec mentions the 24 hour expire period, however, you may want to announce more often than that as peers are constantly leaving\nand joining the DHT, so if the nodes you announced to all left the DHT, you would be out of luck. Luckily, for each announce, we do\nreplicate your contact information to multiple of the closest nodes.\n\n- **Read Only Nodes**: By default, all nodes created are read only; this means that the node will not respond to requests. In theory\nthis sounds good, however, in practice this means it will be harder (but possible) to keep a healthy routing table, especially for\nnodes that wish to run for long periods of time. I strongly encourage users who will be running nodes for long periods of time to\nset up some sort of nat traversal/port forwarding to the source address of the DHT and set read only to false (it is true by default).\n\n- **Source Port vs Connect Port**: One thing you should note is that, by either implementation error or intentionally, if the port that\nthe DHT is bound to is different than the port that we want nodes to connect to us on (our announce/connect port) some nodes will\nincorrectly store the source port that we used to send the announce message instead of the port specified in the message. This is not\na big deal as most nodes handle this correctly ( I have only seen a few that screw this up). If you are receiving TCP connections requests\non the wrong port (the DHT source port), this is most likely why.\n\n- **DHT Spam**: Many nodes in the DHT will ban nodes that they feel are malicious. This includes sending a high number\nof requests, most likely for the same info hash, to the same node. As a user, you will not have control over what nodes we contact in a\nlookup/announce. Over time, we will get better at making sure our clients dont get banned, but to do your part, do not send an excessive\namount of lookups/announces for the same info hash in a short period of time. Symptoms of getting banned include receiving less and less\ncontacts back when doing a search for an info hash. If you feel you have gotten banned, you can always restart the DHT since all nodes\n(should) treat the (node id, source address) as the unique identifier for nodes and we always get a new node id on startup.\n\n- **Sloppy DHT**: The kademlia DHT is also referred to as a sloppy DHT. This means that you will be able to find most (if not all)\nnodes that announce for a given info hash. To make your applications more robust (and this is what torrent clients do), you should\ndevelop a mechanism for receiving the contact information for other peers from peers themselves. This means that if you had two\nsegmented swarms of peers, only one person from one swarm has to be aware of one person from another swarm in order to join the\ntwo swarms so that everyone knows of everyone else.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequalitie%2Fbtdht","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fequalitie%2Fbtdht","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequalitie%2Fbtdht/lists"}