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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! # aria2-protocol
//!
//! Protocol implementations for the aria2-rust download utility.
//!
//! Provides reusable protocol implementations and protocol-level utilities
//! for HTTP/HTTPS, FTP, SFTP, BitTorrent, and Metalink. HTTP, FTP, SOCKS,
//! proxy URL parsing, URI component encoding, and identity defaults are always
//! available; BitTorrent, Metalink, and SFTP are enabled by their respective
//! crate features. The download engine owns task policy, network routing, and
//! process-wide lifecycle; these modules expose protocol operations without
//! depending on the engine.
//!
//! ## Modules
//!
//! - **[`http`]** — Standalone HTTP/HTTPS client built on reqwest, plus reusable
//! request serialization, response parsing, authentication, CONNECT, cookie,
//! content-decoding, redirect, and header-parsing operations. The standalone
//! `HttpClient` does not configure proxies; the download engine composes proxy
//! and network policy around its task-facing clients.
//!
//! - **[`ftp`]** — FTP client: control connection (USER/PASS/CWD/SIZE/PASV/EPSV),
//! passive mode data transfer, anonymous and authenticated login, REST-based resume.
//!
//! - **[`bittorrent`]** *(feature: `bittorrent`)* — Full BitTorrent protocol stack:
//! bencode codec, .torrent parsing, info_hash computation, BT message protocol (10 types),
//! handshake, incoming TCP listener and handshake primitives, Tracker
//! communication (HTTP announce/scrape), DHT network (K-buckets/KRPC), PEX
//! peer exchange, MSE encryption framework, and `PeerConnection`. The engine
//! composes the raw listener with torrent routing, admission, and lifecycle
//! management.
//!
//! - **[`metalink`]** *(feature: `metalink`)* — Metalink V3/V4 XML parser:
//! multi-mirror URL priority, hash verification (MD5/SHA1/SHA256/SHA512),
//! piece checksums, MetaURL torrent detection.
//!
//! - **[`sftp`]** *(feature: `sftp`)* — SFTP over SSH2 client: key/password auth,
//! file operations (stat/read/write/mkdir/rmdir/readdir/symlink), streaming transfer.
//!
//! - **[`socks`]** — SOCKS4/SOCKS5 CONNECT handshakes over caller-provided
//! streams. Socket creation and target-address policy belong to the caller.
//!
//! - **[`proxy`]** — Proxy URL parsing, including percent-decoded credentials;
//! it does not resolve hosts or select routes.
//!
//! - **[`uri`]** — URI component percent-encoding and decoding helpers.
//!
//! - **[`identity`]** — Default product and peer identity strings for standalone
//! library users. Applications can supply their own identity through the
//! higher-level configuration boundary.
/// Default TCP connection timeout for SFTP's SSH transport, in seconds.
pub const DEFAULT_SFTP_CONNECT_TIMEOUT_SECS: u64 = 15;
/// Default TCP port for SSH/SFTP connections.
pub const DEFAULT_SFTP_PORT: u16 = 22;
/// Default SFTP channel read timeout, in seconds.
pub const DEFAULT_SFTP_READ_TIMEOUT_SECS: u64 = 30;
/// Default SSH keepalive interval for SFTP transport, in seconds.
pub const DEFAULT_SFTP_KEEPALIVE_INTERVAL_SECS: u64 = 60;
/// Standard BitTorrent Local Peer Discovery multicast address.
pub const DEFAULT_LPD_MULTICAST_ADDRESS: &str = "239.192.152.143";
/// Standard BitTorrent Local Peer Discovery UDP port.
pub const DEFAULT_LPD_PORT: u16 = 6771;