1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! High-level BitTorrent library.
//!
//! This crate provides the user-facing API for building BitTorrent clients.
//! It depends on [`torrent_core`] for all low-level data types and adds
//! async I/O via tokio for networking, file storage, and session management.
//!
//! # Re-exports
//!
//! Commonly used core types are re-exported for convenience:
//! - [`bencode`], [`error`], [`magnet`], [`metainfo`], [`piece`] from `torrent_core`
//!
//! # Quick Start
//!
//! ```no_run
//! use torrent::session::{Session, SessionConfig};
//!
//! # async fn example() {
//! let config = SessionConfig::default();
//! let session = Session::new(config).await.unwrap();
//!
//! let data = std::fs::read("torrent.torrent").unwrap();
//! let info_hash = session.add_torrent_bytes(&data, "./downloads").await.unwrap();
//! # }
//! ```
// Re-export key core types so users only need `torrent` as a dependency.
pub use ;
// Re-export commonly-used types at the crate root for convenience.
pub use PeerId;
/// Client identifier sent in BEP 10 LTEP handshakes.
///
/// Defaults to `"torrent-rs <version>"`. Library consumers building a
/// custom client should override via the `TORRENT_CLIENT_VERSION`
/// environment variable at compile time:
///
/// ```bash
/// TORRENT_CLIENT_VERSION="MyApp/2.0" cargo build
/// ```
pub const CLIENT_VERSION: &str = match option_env! ;