1mod bprotocol;
2mod dht;
3mod peer_store;
4mod persistence;
5mod routing_table;
6mod utils;
7
8use std::sync::Arc;
9use std::time::Duration;
10
11pub use crate::dht::DhtStats;
12pub use crate::dht::{DhtConfig, DhtState, RequestPeersStream};
13pub use librqbit_core::hash_id::Id20;
14pub use persistence::{PersistentDht, PersistentDhtConfig};
15
16pub type Dht = Arc<DhtState>;
17
18pub(crate) const RESPONSE_TIMEOUT: Duration = Duration::from_secs(60);
20pub(crate) const REQUERY_INTERVAL: Duration = Duration::from_secs(60);
22pub(crate) const INACTIVITY_TIMEOUT: Duration = Duration::from_secs(15 * 60);
24
25pub struct DhtBuilder {}
26
27impl DhtBuilder {
28 #[allow(clippy::new_ret_no_self)]
29 pub async fn new() -> anyhow::Result<Dht> {
30 DhtState::new().await
31 }
32
33 pub async fn with_config(config: DhtConfig) -> anyhow::Result<Dht> {
34 DhtState::with_config(config).await
35 }
36}
37
38pub static DHT_BOOTSTRAP: &[&str] = &["dht.transmissionbt.com:6881", "dht.libtorrent.org:25401"];