DHT Rate limiting

This commit is contained in:
Igor Katson 2023-11-22 21:56:00 +00:00
parent 50ca906421
commit 56311fb4df
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 52 additions and 12 deletions

View file

@ -1,13 +1,19 @@
use std::{str::FromStr, time::Duration};
use std::time::Duration;
use anyhow::Context;
use librqbit_dht::{Dht, Id20};
use librqbit_core::magnet::Magnet;
use librqbit_dht::Dht;
use tokio_stream::StreamExt;
use tracing::info;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let info_hash = Id20::from_str("64a980abe6e448226bb930ba061592e44c3781a1").unwrap();
let magnet = std::env::args()
.nth(1)
.expect("first argument should be a magnet link");
let magnet = Magnet::parse(&magnet).unwrap();
let info_hash = magnet.info_hash;
tracing_subscriber::fmt::init();
let dht = Dht::new().await.context("error initializing DHT")?;