Skip to main content

irontide_session/
lib.rs

1#![warn(missing_docs)]
2//! `BitTorrent` session management: peers, torrents, and piece selection.
3
4pub mod alert;
5/// Transactional `apply_settings` skeleton with phase-ordered rollback (M173 Lane B).
6pub mod apply;
7/// qBt-compat category registry (M170).
8pub mod category_manager;
9mod error;
10pub(crate) mod metadata;
11pub(crate) mod metadata_resolver;
12/// M226: engine-side OS notification dispatcher
13/// (completion + error toasts via `notify-rust` / zbus).
14pub mod notification;
15/// M226: engine-side watched-folder auto-add dispatcher
16/// (notify-debouncer-full → `add_torrent`).
17pub mod watched_folder;
18pub(crate) mod peer_state;
19/// Shared helpers for TOML-backed user-facing registries (category/tag) — M171.
20pub(crate) mod registry_common;
21/// Save-path token expansion (M173 Lane A — Decision 5).
22pub mod save_path;
23mod settings;
24/// qBt-compat tag registry (M171).
25pub mod tag_manager;
26mod types;
27// These will be added as they're implemented:
28pub(crate) mod ban;
29pub(crate) mod blocking_spawner;
30pub(crate) mod buffer_pool;
31pub(crate) mod choker;
32#[allow(dead_code)] // M73: retained for endgame pathway and future use
33pub(crate) mod chunk_mask;
34/// Disk I/O manager: configuration, handles, and statistics.
35pub mod disk;
36/// Pluggable disk I/O backend trait and implementations.
37pub mod disk_backend;
38#[allow(dead_code)] // Wired in during Task 2 (DSCP wiring to session/torrent actors).
39pub(crate) mod dscp;
40pub(crate) mod end_game;
41pub mod extension;
42pub mod hash_pool;
43/// io_uring disk I/O backend (Linux-only, feature-gated).
44#[cfg(all(target_os = "linux", feature = "io-uring"))]
45pub(crate) mod io_uring_backend;
46/// IOCP disk I/O backend (Windows-only, feature-gated).
47#[cfg(all(target_os = "windows", feature = "iocp"))]
48pub(crate) mod iocp_backend;
49// have_buffer removed in M118 — replaced by broadcast channel
50pub mod i2p;
51pub(crate) mod ip_filter;
52#[allow(dead_code)] // Wired in during Task 2 (session.rs integration).
53pub(crate) mod listener;
54pub(crate) mod lsd;
55pub(crate) mod lt_trackers;
56pub(crate) mod peer;
57pub(crate) mod peer_adder;
58pub(crate) mod peer_backpressure;
59pub(crate) mod peer_codec;
60pub(crate) mod peer_connection;
61#[allow(dead_code)] // Wired in during Task 2 (BEP 40 peer eviction integration).
62pub(crate) mod peer_priority;
63pub(crate) mod peer_shared;
64pub(crate) mod peer_states;
65pub(crate) mod peer_tasks;
66mod persistence;
67pub(crate) mod pex;
68pub(crate) mod piece_reservation;
69#[allow(dead_code)] // M73: retained for endgame pathway and future use
70pub(crate) mod piece_selector;
71pub(crate) mod pipeline;
72#[allow(dead_code)] // Wired in during Step 5 (proxy integration).
73pub(crate) mod proxy;
74pub(crate) mod queue;
75pub(crate) mod rate_limiter;
76/// Resume file persistence: serialize, deserialize, atomic write, and directory helpers.
77pub mod resume_file;
78mod session;
79pub(crate) mod slot_tuner;
80#[allow(dead_code)] // Wired in during Phase 3c (session SSL integration).
81pub(crate) mod ssl_manager;
82pub mod stats;
83pub mod streaming;
84pub(crate) mod super_seed;
85pub(crate) mod timed_lock;
86mod torrent;
87mod torrent_dispatch;
88pub(crate) mod torrent_peer_handler;
89mod torrent_peers;
90mod torrent_state;
91mod torrent_verify;
92pub(crate) mod tracker_manager;
93pub mod transport;
94// M218: was `pub(crate)`. Promoted to `pub` so the GUI's URL-tab fetch can
95// share the same SSRF redirect policy / validators as tracker + web-seed
96// HTTP code. Only the four items below are exported from the module —
97// internal helpers remain unreachable to external callers.
98pub mod url_guard;
99pub(crate) mod utp_routing;
100pub(crate) mod vectored_io;
101/// Verify-Before-Download: fast file-size pre-scan (M205).
102pub mod verify_before_download;
103pub(crate) mod web_seed;
104
105pub use crate::piece_selector::build_wanted_pieces;
106pub use crate::tracker_manager::{TrackerInfo, TrackerStatus};
107pub use alert::{Alert, AlertCategory, AlertKind, AlertStream};
108pub use apply::{ApplyError, Phase, ReconfigGuard, ReconfigInFlight, apply_phases_with_rollback};
109pub use ban::BanConfig;
110pub use category_manager::{
111    CategoryError, CategoryMetadata, CategoryRegistry, resolve_category_registry_path,
112};
113pub use choker::{ChokingAlgorithm, SeedChokingAlgorithm};
114pub use disk::{DiskConfig, DiskHandle, DiskJobFlags, DiskManagerHandle, DiskStats};
115pub use disk_backend::{DisabledDiskIo, DiskIoBackend, DiskIoStats};
116pub use error::{Error, Result};
117pub use extension::ExtensionPlugin;
118pub use hash_pool::{HashJob, HashPool, HashResult};
119pub use i2p::{I2pDestination, I2pDestinationError};
120pub use ip_filter::{IpFilter, IpFilterError, PortFilter, parse_dat, parse_p2p};
121pub use irontide_core::{WebSeedState, WebSeedStats};
122pub use peer_state::PeerSource;
123pub use peer_states::PeerPipelineSnapshot;
124pub use persistence::{DhtNodeEntry, PeerStrikeEntry, SessionState, validate_resume_bitfield};
125pub use proxy::{ProxyConfig, ProxyType};
126pub use rate_limiter::MixedModeAlgorithm;
127pub use resume_file::{ResumeFileError, default_resume_dir};
128pub use save_path::{
129    ExpandSavePathError, SimpleContentType, TorrentSavePathContext, expand_save_path_for_category,
130    expand_save_path_template,
131};
132pub use session::{AddSource, AddTorrentParams, AppliedSettings, ResumeLoadResult, SessionHandle};
133pub use settings::{
134    DEFAULT_ADMINADMIN_HASH, MaxRatioAction, QbtCompatSettings, QbtCredentialMigration,
135    QbtMigrationError, Settings, hash_qbt_password, migrate_qbt_credentials,
136};
137pub use stats::{
138    MetricKind, NUM_METRICS, SessionCounters, SessionStatsMetric, session_stats_metrics,
139};
140pub use streaming::FileStream;
141pub use tag_manager::{TagError, TagRegistry, resolve_tag_registry_path};
142pub use torrent::TorrentHandle;
143pub use transport::{BoxedStream, NetworkFactory, TransportListener};
144pub use types::{
145    DebugDispatchState, DebugPeerState, DebugState, DebugTorrentState, FileInfo, FileMode,
146    FileStatus, PartialPieceInfo, PeerInfo, SessionStats, StorageFactory, TorrentConfig,
147    TorrentFlags, TorrentInfo, TorrentState, TorrentStats, TorrentSummary,
148};