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
//! # aria2-rpc
//!
//! RPC (Remote Procedure Call) library for aria2-rust, providing JSON-RPC 2.0,
//! XML-RPC, and WebSocket interfaces compatible with the original aria2 RPC API.
//!
//! ## Modules
//!
//! - **[`json_rpc`]** — JSON-RPC 2.0 protocol implementation: request/response/error
//! models, batch support, standard error codes (-32700 to -32603), parameter extractors.
//!
//! - **[`xml_rpc`]** — XML-RPC protocol: methodCall/methodResponse/fault encoding,
//! 8 value types (Int/String/Boolean/Double/Array/Struct/Base64/Nil), quick-xml codec.
//!
//! - **[`websocket`]** — Real-time event notifications via WebSocket:
//! 7 event types (DownloadStart/Pause/Stop/Complete/Error/BtComplete/BtError),
//! `EventPublisher` pub/sub using tokio::broadcast.
//!
//! - **[`server`]** — HTTP server framework: `AuthConfig` (Token + Basic dual auth),
//! `CorsConfig`, status models (`StatusInfo`, `GlobalStat`, `DownloadStatus`),
//! GID generation utility.
//!
//! - **[`engine`]** — `RpcEngine` bridge implementing 36 aria2 RPC methods:
//! addUri/addTorrent/remove/pause/unpause/tellStatus/tellActive/tellWaiting/
//! tellStopped/getGlobalStat/purgeDownloadResult/getGlobalOption/changeGlobalOption/
//! getOption/changeOption/getVersion/getSessionInfo/saveSession/shutdown/forceShutdown/
//! system.multicall/system.listMethods/system.listNotifications.
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use aria2_rpc::engine::RpcEngine;
//! use aria2_rpc::json_rpc::JsonRpcRequest;
//!
//! #[tokio::main]
//! async fn main() {
//! let engine = RpcEngine::new();
//!
//! let req = JsonRpcRequest {
//! version: Some("2.0".into()),
//! method: "aria2.addUri".into(),
//! params: serde_json::json!([["http://example.com/file.zip"]]),
//! id: Some(serde_json::Value::String("req-1".into())),
//! };
//!
//! let resp = engine.handle_request(&req).await;
//! if resp.is_success() {
//! println!("GID: {:?}", resp.result);
//! }
//! }
//! ```
//!
//! ## Compatibility
//!
//! All 36 implemented methods follow the original aria2 RPC specification at
//! <https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface>.
pub use RpcEngine;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;