Simple, robust, BitTorrent's Mainline DHT implementation
Find a file
2024-11-29 18:24:26 +03:00
.github/workflows chore: update workflow 2024-04-16 14:17:02 +03:00
docs feat: make ClosestNodes public 2024-11-29 18:18:23 +03:00
examples fixed formating 2024-11-27 13:41:30 +01:00
src feat: make ClosestNodes public 2024-11-29 18:18:23 +03:00
.gitignore docs: update censorship resistance docs 2024-11-08 15:47:21 +03:00
Cargo.toml chore: Release mainline version 4.1.0 2024-11-29 18:18:49 +03:00
CHANGELOG.md chore: update changelog 2024-11-29 18:24:26 +03:00
clippy.toml chore: allow unwrap in tests 2024-09-27 18:46:03 +03:00
LICENSE initial commit 2023-10-17 11:13:27 +03:00
README.md docs: document censorship resistance 2024-11-07 20:19:00 +03:00

Mainline

Simple, robust, BitTorrent's Mainline DHT implementation.

This library is focused on being the best and simplest Rust client for Mainline, especially focused on reliable and fast time-to-first-response.

It should work as a routing / storing node as well, and has been running in production for many months without an issue. However if you are running your separate (read: small) DHT, or otherwise facing unusual DoS attack, you should consider implementing rate limiting.

API Docs

Getting started

Check the Examples.

Features

Client

Running as a client, means you can store and query for values on the DHT, but not accept any incoming requests.

use mainline::Dht;

let dht = Dht::client(); // or `Dht::default();`

Supported BEPs:

This implementation also includes measures against Vertical Sybil Attacks.

Server

Running as a server is the same as a client, but you also respond to incoming requests and serve as a routing and storing node, supporting the general routing of the DHT, and contributing to the storage capacity of the DHT.

use mainline::Dht;

let dht = Dht::server(); // or `Dht::builder::server().build();` for more control.

Supported BEPs:

Rate limiting

The default server implementation has no rate-limiting, you can run your own custom server and apply your custom rate-limiting. However, that limit/block will only apply after parsing incoming messages, and it won't affect handling incoming responses.

Acknowledgment

This implementation was possible thanks to Webtorrent's Bittorrent-dht as a reference, and Rustydht-lib that saved me a lot of time, especially at the serialization and deserialization of Bencode messages.