Skip to main content

iroh_content_discovery/
lib.rs

1//! A library for discovering content using a tracker.
2//!
3//! This library contains the protocol for announcing and querying content, as
4//! well as a simple client implementation.
5//!
6//! # Protocol
7//!
8//! The protocol is defined in the [protocol] module.
9//!
10//! # Client
11//!
12//! Client functionality uses the `client` feature flag, which is enabled by
13//! default. Disable it if you only need the protocol and want to minimize
14//! dependencies.
15//!
16//! The client implementation is using 0-rtt to minimize latency when announcing
17//! or querying content. For details about how to use 0-rtt in iroh, see this
18//! [blog post](https://www.iroh.computer/blog/0rtt-api/).
19//!
20//! Note that both announce and query will dial the tracker using just a node ID,
21//! so the endpoint must have node discovery enabled, and the tracker must
22//! announce itself to that node discovery mechanism.
23//!
24//! Use [announce] to announce content to a tracker, and
25//! [query] to query a tracker for content.
26//!
27//! The higher level functions [announce_all] and [query_all] can be used to
28//! announce to or or query from multiple trackers at once. They use
29//! [futures_buffered](https://docs.rs/futures-buffered/latest/futures_buffered/)
30//! for concurrency and are intended for the common case of working with multiple
31//! trackers.
32//!
33//! The lower level functions [announce_conn] and [query_conn] can be used to
34//! announce to or query a tracker using an existing connection.
35#[cfg(feature = "client")]
36mod client;
37pub mod protocol;
38#[cfg(feature = "client")]
39pub use client::*;
40pub use protocol::ALPN;