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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use clap::Parser;
#[derive(Parser, Debug)]
#[command(name = "tur", author, version, about, long_about = None)]
pub struct Cli {
/// URL(s) to download
#[arg(short, long, num_args = 1..)]
pub url: Vec<String>,
/// Download directory
#[arg(short, long, default_value = ".")]
pub dir: String,
/// Initial connections per download
#[arg(short, long)]
pub connections: Option<usize>,
/// Per-download minimum connection count for autonomous scaling
#[arg(long)]
pub min_connections: Option<usize>,
/// Per-download maximum connection count for autonomous scaling
#[arg(long)]
pub max_connections: Option<usize>,
/// Concurrent downloads (tasks)
#[arg(short, long, default_value_t = 3)]
pub tasks: usize,
/// Run the scheduler without issuing range GET requests
#[arg(long, default_value_t = false)]
pub dry_run: bool,
/// Synthetic size for dry runs, in MiB
#[arg(long)]
pub dry_run_size_mb: Option<u64>,
/// Borrow stop threshold, in MiB
#[arg(long, default_value_t = 2)]
pub borrow_limit_mb: u64,
/// Scheduler mode: equal or fib
#[arg(long, default_value = "equal")]
pub schedule_mode: String,
/// HTTP transport mode: auto, http1, or http2
#[arg(long, default_value = "http1")]
pub http_mode: String,
/// Run without the TUI and exit when tasks finish
#[arg(long, default_value_t = false)]
pub headless: bool,
/// Root directory for engine logs and metadata
#[arg(long)]
pub log_root: Option<String>,
/// Disable persisted origin behavior memory
#[arg(long, default_value_t = false)]
pub no_origin_memory: bool,
/// System-wide ceiling for active download connections
#[arg(long, default_value_t = 32)]
pub max_total_connections: usize,
/// Global bandwidth cap in Mbps, 0 disables the cap
#[arg(long, default_value_t = 0)]
pub bandwidth_limit: u64,
/// Per-download bandwidth cap in Mbps, 0 disables the cap
#[arg(long, default_value_t = 0)]
pub per_download_limit: u64,
/// Disable Linux pwrite zero-copy write path
#[arg(long = "no-pwrite", default_value_t = false)]
pub no_pwrite: bool,
/// Disable Linux kernel splice() zero-copy write path (pipe+splice)
#[arg(long, default_value_t = false)]
pub no_splice: bool,
/// Disable Linux io_uring write path (experimental)
#[arg(long, default_value_t = false)]
pub no_io_uring: bool,
/// Disable Direct I/O (FILE_FLAG_NO_BUFFERING) on Windows; has no effect on other platforms
#[arg(long, default_value_t = false)]
pub no_direct_io: bool,
/// Number of worker threads for the async runtime; 1 = single-threaded
#[arg(long, default_value_t = 1)]
pub runtime_threads: usize,
/// Custom HTTP header(s) to include with every request (e.g. "X-API-Key: secret")
#[arg(long, num_args = 0.., value_name = "HEADER")]
pub header: Vec<String>,
/// Referer URL to include with every request
#[arg(long)]
pub referer: Option<String>,
/// Bearer token for Authorization header (e.g. "eyJ...")
#[arg(long = "auth-bearer")]
pub auth_bearer: Option<String>,
/// Path to a Netscape-format cookie file to import
#[arg(long = "cookie-file")]
pub cookie_file: Option<String>,
}