prefs.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /* <!-- copyright */
  2. /*
  3. * aria2 - The high speed download utility
  4. *
  5. * Copyright (C) 2006 Tatsuhiro Tsujikawa
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * In addition, as a special exception, the copyright holders give
  22. * permission to link the code of portions of this program with the
  23. * OpenSSL library under certain conditions as described in each
  24. * individual source file, and distribute linked combinations
  25. * including the two.
  26. * You must obey the GNU General Public License in all respects
  27. * for all of the code used other than OpenSSL. If you modify
  28. * file(s) with this exception, you may extend this exception to your
  29. * version of the file(s), but you are not obligated to do so. If you
  30. * do not wish to do so, delete this exception statement from your
  31. * version. If you delete this exception statement from all source
  32. * files in the program, then also delete it here.
  33. */
  34. /* copyright --> */
  35. #include "prefs.h"
  36. #include <cassert>
  37. #include <vector>
  38. #include <map>
  39. namespace aria2 {
  40. Pref::Pref(const char* k, size_t i):k(k), i(i) {}
  41. namespace {
  42. class PrefFactory {
  43. public:
  44. PrefFactory():count_(0)
  45. {
  46. // We add special null pref whose ID is 0.
  47. makePref("");
  48. }
  49. ~PrefFactory()
  50. {
  51. for(size_t i = 0; i < count_; ++i) {
  52. delete i2p_[i];
  53. }
  54. }
  55. size_t nextId()
  56. {
  57. return count_++;
  58. }
  59. Pref* makePref(const char* key)
  60. {
  61. size_t id = nextId();
  62. Pref* pref = new Pref(key, id);
  63. i2p_.push_back(pref);
  64. k2p_[key] = pref;
  65. return pref;
  66. }
  67. size_t getCount() const
  68. {
  69. return count_;
  70. }
  71. const Pref* i2p(size_t id) const
  72. {
  73. assert(id < count_);
  74. return i2p_[id];
  75. }
  76. const Pref* k2p(const std::string& k) const
  77. {
  78. std::map<std::string, const Pref*>::const_iterator i = k2p_.find(k);
  79. if(i == k2p_.end()) {
  80. return i2p_[0];
  81. } else {
  82. return (*i).second;
  83. }
  84. }
  85. private:
  86. size_t count_;
  87. std::vector<const Pref*> i2p_;
  88. std::map<std::string, const Pref*> k2p_;
  89. };
  90. PrefFactory* getPrefFactory()
  91. {
  92. static PrefFactory* pf = new PrefFactory();
  93. return pf;
  94. }
  95. Pref* makePref(const char* key)
  96. {
  97. return getPrefFactory()->makePref(key);
  98. }
  99. } // namespace
  100. namespace option {
  101. size_t countOption()
  102. {
  103. return getPrefFactory()->getCount();
  104. }
  105. const Pref* i2p(size_t id)
  106. {
  107. return getPrefFactory()->i2p(id);
  108. }
  109. const Pref* k2p(const std::string& key)
  110. {
  111. return getPrefFactory()->k2p(key);
  112. }
  113. void deletePrefResource()
  114. {
  115. delete getPrefFactory();
  116. }
  117. } // namespace option
  118. /**
  119. * Constants
  120. */
  121. const std::string A2_V_TRUE("true");
  122. const std::string A2_V_FALSE("false");
  123. const std::string A2_V_DEFAULT("default");
  124. const std::string V_NONE("none");
  125. const std::string V_MEM("mem");
  126. const std::string V_ALL("all");
  127. const std::string A2_V_FULL("full");
  128. const std::string A2_V_GEOM("geom");
  129. const std::string V_PREALLOC("prealloc");
  130. const std::string V_FALLOC("falloc");
  131. const std::string V_TRUNC("trunc");
  132. const std::string V_DEBUG("debug");
  133. const std::string V_INFO("info");
  134. const std::string V_NOTICE("notice");
  135. const std::string V_WARN("warn");
  136. const std::string V_ERROR("error");
  137. const std::string V_INORDER("inorder");
  138. const std::string V_FEEDBACK("feedback");
  139. const std::string V_ADAPTIVE("adaptive");
  140. const std::string V_LIBUV("libuv");
  141. const std::string V_EPOLL("epoll");
  142. const std::string V_KQUEUE("kqueue");
  143. const std::string V_PORT("port");
  144. const std::string V_POLL("poll");
  145. const std::string V_SELECT("select");
  146. const std::string V_BINARY("binary");
  147. const std::string V_ASCII("ascii");
  148. const std::string V_GET("get");
  149. const std::string V_TUNNEL("tunnel");
  150. const std::string V_PLAIN("plain");
  151. const std::string V_ARC4("arc4");
  152. const std::string V_HTTP("http");
  153. const std::string V_HTTPS("https");
  154. const std::string V_FTP("ftp");
  155. const Pref* PREF_VERSION = makePref("version");
  156. const Pref* PREF_HELP = makePref("help");
  157. /**
  158. * General preferences
  159. */
  160. // values: 1*digit
  161. const Pref* PREF_TIMEOUT = makePref("timeout");
  162. // values: 1*digit
  163. const Pref* PREF_DNS_TIMEOUT = makePref("dns-timeout");
  164. // values: 1*digit
  165. const Pref* PREF_CONNECT_TIMEOUT = makePref("connect-timeout");
  166. // values: 1*digit
  167. const Pref* PREF_MAX_TRIES = makePref("max-tries");
  168. // values: 1*digit
  169. const Pref* PREF_AUTO_SAVE_INTERVAL = makePref("auto-save-interval");
  170. // values: a string that your file system recognizes as a file name.
  171. const Pref* PREF_LOG = makePref("log");
  172. // values: a string that your file system recognizes as a directory.
  173. const Pref* PREF_DIR = makePref("dir");
  174. // values: a string that your file system recognizes as a file name.
  175. const Pref* PREF_OUT = makePref("out");
  176. // values: 1*digit
  177. const Pref* PREF_SPLIT = makePref("split");
  178. // value: true | false
  179. const Pref* PREF_DAEMON = makePref("daemon");
  180. // value: a string
  181. const Pref* PREF_REFERER = makePref("referer");
  182. // value: 1*digit
  183. const Pref* PREF_LOWEST_SPEED_LIMIT = makePref("lowest-speed-limit");
  184. // value: 1*digit
  185. const Pref* PREF_PIECE_LENGTH = makePref("piece-length");
  186. // value: 1*digit
  187. const Pref* PREF_MAX_OVERALL_DOWNLOAD_LIMIT = makePref("max-overall-download-limit");
  188. // value: 1*digit
  189. const Pref* PREF_MAX_DOWNLOAD_LIMIT = makePref("max-download-limit");
  190. // value: 1*digit
  191. const Pref* PREF_STARTUP_IDLE_TIME = makePref("startup-idle-time");
  192. // value: prealloc | fallc | none
  193. const Pref* PREF_FILE_ALLOCATION = makePref("file-allocation");
  194. // value: 1*digit
  195. const Pref* PREF_NO_FILE_ALLOCATION_LIMIT = makePref("no-file-allocation-limit");
  196. // value: true | false
  197. const Pref* PREF_ALLOW_OVERWRITE = makePref("allow-overwrite");
  198. // value: true | false
  199. const Pref* PREF_REALTIME_CHUNK_CHECKSUM = makePref("realtime-chunk-checksum");
  200. // value: true | false
  201. const Pref* PREF_CHECK_INTEGRITY = makePref("check-integrity");
  202. // value: string that your file system recognizes as a file name.
  203. const Pref* PREF_NETRC_PATH = makePref("netrc-path");
  204. // value:
  205. const Pref* PREF_CONTINUE = makePref("continue");
  206. // value:
  207. const Pref* PREF_NO_NETRC = makePref("no-netrc");
  208. // value: 1*digit
  209. const Pref* PREF_MAX_DOWNLOADS = makePref("max-downloads");
  210. // value: string that your file system recognizes as a file name.
  211. const Pref* PREF_INPUT_FILE = makePref("input-file");
  212. // value: true | false
  213. const Pref* PREF_DEFERRED_INPUT = makePref("deferred-input");
  214. // value: 1*digit
  215. const Pref* PREF_MAX_CONCURRENT_DOWNLOADS = makePref("max-concurrent-downloads");
  216. // value: true | false
  217. const Pref* PREF_FORCE_SEQUENTIAL = makePref("force-sequential");
  218. // value: true | false
  219. const Pref* PREF_AUTO_FILE_RENAMING = makePref("auto-file-renaming");
  220. // value: true | false
  221. const Pref* PREF_PARAMETERIZED_URI = makePref("parameterized-uri");
  222. // value: true | false
  223. const Pref* PREF_ALLOW_PIECE_LENGTH_CHANGE = makePref("allow-piece-length-change");
  224. // value: true | false
  225. const Pref* PREF_NO_CONF = makePref("no-conf");
  226. // value: string
  227. const Pref* PREF_CONF_PATH = makePref("conf-path");
  228. // value: 1*digit
  229. const Pref* PREF_STOP = makePref("stop");
  230. // value: true | false
  231. const Pref* PREF_QUIET = makePref("quiet");
  232. // value: true | false
  233. const Pref* PREF_ASYNC_DNS = makePref("async-dns");
  234. // value: 1*digit
  235. const Pref* PREF_SUMMARY_INTERVAL = makePref("summary-interval");
  236. // value: debug, info, notice, warn, error
  237. const Pref* PREF_LOG_LEVEL = makePref("log-level");
  238. // value: debug, info, notice, warn, error
  239. const Pref* PREF_CONSOLE_LOG_LEVEL = makePref("console-log-level");
  240. // value: inorder | feedback | adaptive
  241. const Pref* PREF_URI_SELECTOR = makePref("uri-selector");
  242. // value: 1*digit
  243. const Pref* PREF_SERVER_STAT_TIMEOUT = makePref("server-stat-timeout");
  244. // value: string that your file system recognizes as a file name.
  245. const Pref* PREF_SERVER_STAT_IF = makePref("server-stat-if");
  246. // value: string that your file system recognizes as a file name.
  247. const Pref* PREF_SERVER_STAT_OF = makePref("server-stat-of");
  248. // value: true | false
  249. const Pref* PREF_REMOTE_TIME = makePref("remote-time");
  250. // value: 1*digit
  251. const Pref* PREF_MAX_FILE_NOT_FOUND = makePref("max-file-not-found");
  252. // value: epoll | select
  253. const Pref* PREF_EVENT_POLL = makePref("event-poll");
  254. // value: true | false
  255. const Pref* PREF_ENABLE_RPC = makePref("enable-rpc");
  256. // value: 1*digit
  257. const Pref* PREF_RPC_LISTEN_PORT = makePref("rpc-listen-port");
  258. // value: string
  259. const Pref* PREF_RPC_USER = makePref("rpc-user");
  260. // value: string
  261. const Pref* PREF_RPC_PASSWD = makePref("rpc-passwd");
  262. // value: 1*digit
  263. const Pref* PREF_RPC_MAX_REQUEST_SIZE = makePref("rpc-max-request-size");
  264. // value: true | false
  265. const Pref* PREF_RPC_LISTEN_ALL = makePref("rpc-listen-all");
  266. // value: true | false
  267. const Pref* PREF_RPC_ALLOW_ORIGIN_ALL = makePref("rpc-allow-origin-all");
  268. // value: string that your file system recognizes as a file name.
  269. const Pref* PREF_RPC_CERTIFICATE = makePref("rpc-certificate");
  270. // value: string that your file system recognizes as a file name.
  271. const Pref* PREF_RPC_PRIVATE_KEY = makePref("rpc-private-key");
  272. // value: true | false
  273. const Pref* PREF_RPC_SECURE = makePref("rpc-secure");
  274. // value: true | false
  275. const Pref* PREF_RPC_SAVE_UPLOAD_METADATA = makePref("rpc-save-upload-metadata");
  276. // value: true | false
  277. const Pref* PREF_DRY_RUN = makePref("dry-run");
  278. // value: true | false
  279. const Pref* PREF_REUSE_URI = makePref("reuse-uri");
  280. // value: string
  281. const Pref* PREF_ON_DOWNLOAD_START = makePref("on-download-start");
  282. const Pref* PREF_ON_DOWNLOAD_PAUSE = makePref("on-download-pause");
  283. const Pref* PREF_ON_DOWNLOAD_STOP = makePref("on-download-stop");
  284. const Pref* PREF_ON_DOWNLOAD_COMPLETE = makePref("on-download-complete");
  285. const Pref* PREF_ON_DOWNLOAD_ERROR = makePref("on-download-error");
  286. // value: string
  287. const Pref* PREF_INTERFACE = makePref("interface");
  288. // value: true | false
  289. const Pref* PREF_DISABLE_IPV6 = makePref("disable-ipv6");
  290. // value: true | false
  291. const Pref* PREF_HUMAN_READABLE = makePref("human-readable");
  292. // value: true | false
  293. const Pref* PREF_REMOVE_CONTROL_FILE = makePref("remove-control-file");
  294. // value: true | false
  295. const Pref* PREF_ALWAYS_RESUME = makePref("always-resume");
  296. // value: 1*digit
  297. const Pref* PREF_MAX_RESUME_FAILURE_TRIES = makePref("max-resume-failure-tries");
  298. // value: string that your file system recognizes as a file name.
  299. const Pref* PREF_SAVE_SESSION = makePref("save-session");
  300. // value: 1*digit
  301. const Pref* PREF_MAX_CONNECTION_PER_SERVER = makePref("max-connection-per-server");
  302. // value: 1*digit
  303. const Pref* PREF_MIN_SPLIT_SIZE = makePref("min-split-size");
  304. // value: true | false
  305. const Pref* PREF_CONDITIONAL_GET = makePref("conditional-get");
  306. // value: true | false
  307. const Pref* PREF_SELECT_LEAST_USED_HOST = makePref("select-least-used-host");
  308. // value: true | false
  309. const Pref* PREF_ENABLE_ASYNC_DNS6 = makePref("enable-async-dns6");
  310. // value: 1*digit
  311. const Pref* PREF_MAX_DOWNLOAD_RESULT = makePref("max-download-result");
  312. // value: 1*digit
  313. const Pref* PREF_RETRY_WAIT = makePref("retry-wait");
  314. // value: string
  315. const Pref* PREF_ASYNC_DNS_SERVER = makePref("async-dns-server");
  316. // value: true | false
  317. const Pref* PREF_SHOW_CONSOLE_READOUT = makePref("show-console-readout");
  318. // value: default | inorder
  319. const Pref* PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
  320. // value: true | false
  321. const Pref* PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
  322. // value: true | false
  323. const Pref* PREF_PAUSE = makePref("pause");
  324. // value: default | full
  325. const Pref* PREF_DOWNLOAD_RESULT = makePref("download-result");
  326. // value: true | false
  327. const Pref* PREF_HASH_CHECK_ONLY = makePref("hash-check-only");
  328. // values: hashType=digest
  329. const Pref* PREF_CHECKSUM = makePref("checksum");
  330. // value: pid
  331. const Pref* PREF_STOP_WITH_PROCESS = makePref("stop-with-process");
  332. // value: true | false
  333. const Pref* PREF_ENABLE_MMAP = makePref("enable-mmap");
  334. // value: true | false
  335. const Pref* PREF_FORCE_SAVE = makePref("force-save");
  336. // value: 1*digit
  337. const Pref* PREF_DISK_CACHE = makePref("disk-cache");
  338. // value: string
  339. const Pref* PREF_GID = makePref("gid");
  340. // values: 1*digit
  341. const Pref* PREF_SAVE_SESSION_INTERVAL = makePref("save-session-interval");
  342. /**
  343. * FTP related preferences
  344. */
  345. const Pref* PREF_FTP_USER = makePref("ftp-user");
  346. const Pref* PREF_FTP_PASSWD = makePref("ftp-passwd");
  347. // values: binary | ascii
  348. const Pref* PREF_FTP_TYPE = makePref("ftp-type");
  349. // values: true | false
  350. const Pref* PREF_FTP_PASV = makePref("ftp-pasv");
  351. // values: true | false
  352. const Pref* PREF_FTP_REUSE_CONNECTION = makePref("ftp-reuse-connection");
  353. /**
  354. * HTTP related preferences
  355. */
  356. const Pref* PREF_HTTP_USER = makePref("http-user");
  357. const Pref* PREF_HTTP_PASSWD = makePref("http-passwd");
  358. // values: string
  359. const Pref* PREF_USER_AGENT = makePref("user-agent");
  360. // value: string that your file system recognizes as a file name.
  361. const Pref* PREF_LOAD_COOKIES = makePref("load-cookies");
  362. // value: string that your file system recognizes as a file name.
  363. const Pref* PREF_SAVE_COOKIES = makePref("save-cookies");
  364. // values: true | false
  365. const Pref* PREF_ENABLE_HTTP_KEEP_ALIVE = makePref("enable-http-keep-alive");
  366. // values: true | false
  367. const Pref* PREF_ENABLE_HTTP_PIPELINING = makePref("enable-http-pipelining");
  368. // value: 1*digit
  369. const Pref* PREF_MAX_HTTP_PIPELINING = makePref("max-http-pipelining");
  370. // value: string
  371. const Pref* PREF_HEADER = makePref("header");
  372. // value: string that your file system recognizes as a file name.
  373. const Pref* PREF_CERTIFICATE = makePref("certificate");
  374. // value: string that your file system recognizes as a file name.
  375. const Pref* PREF_PRIVATE_KEY = makePref("private-key");
  376. // value: string that your file system recognizes as a file name.
  377. const Pref* PREF_CA_CERTIFICATE = makePref("ca-certificate");
  378. // value: true | false
  379. const Pref* PREF_CHECK_CERTIFICATE = makePref("check-certificate");
  380. // value: true | false
  381. const Pref* PREF_USE_HEAD = makePref("use-head");
  382. // value: true | false
  383. const Pref* PREF_HTTP_AUTH_CHALLENGE = makePref("http-auth-challenge");
  384. // value: true | false
  385. const Pref* PREF_HTTP_NO_CACHE = makePref("http-no-cache");
  386. // value: true | false
  387. const Pref* PREF_HTTP_ACCEPT_GZIP = makePref("http-accept-gzip");
  388. /**
  389. * Proxy related preferences
  390. */
  391. const Pref* PREF_HTTP_PROXY = makePref("http-proxy");
  392. const Pref* PREF_HTTPS_PROXY = makePref("https-proxy");
  393. const Pref* PREF_FTP_PROXY = makePref("ftp-proxy");
  394. const Pref* PREF_ALL_PROXY = makePref("all-proxy");
  395. // values: comma separeted hostname or domain
  396. const Pref* PREF_NO_PROXY = makePref("no-proxy");
  397. // values: get | tunnel
  398. const Pref* PREF_PROXY_METHOD = makePref("proxy-method");
  399. const Pref* PREF_HTTP_PROXY_USER = makePref("http-proxy-user");
  400. const Pref* PREF_HTTP_PROXY_PASSWD = makePref("http-proxy-passwd");
  401. const Pref* PREF_HTTPS_PROXY_USER = makePref("https-proxy-user");
  402. const Pref* PREF_HTTPS_PROXY_PASSWD = makePref("https-proxy-passwd");
  403. const Pref* PREF_FTP_PROXY_USER = makePref("ftp-proxy-user");
  404. const Pref* PREF_FTP_PROXY_PASSWD = makePref("ftp-proxy-passwd");
  405. const Pref* PREF_ALL_PROXY_USER = makePref("all-proxy-user");
  406. const Pref* PREF_ALL_PROXY_PASSWD = makePref("all-proxy-passwd");
  407. /**
  408. * BitTorrent related preferences
  409. */
  410. // values: 1*digit
  411. const Pref* PREF_PEER_CONNECTION_TIMEOUT = makePref("peer-connection-timeout");
  412. // values: 1*digit
  413. const Pref* PREF_BT_TIMEOUT = makePref("bt-timeout");
  414. // values: 1*digit
  415. const Pref* PREF_BT_REQUEST_TIMEOUT = makePref("bt-request-timeout");
  416. // values: true | false
  417. const Pref* PREF_SHOW_FILES = makePref("show-files");
  418. // values: 1*digit
  419. const Pref* PREF_MAX_OVERALL_UPLOAD_LIMIT = makePref("max-overall-upload-limit");
  420. // values: 1*digit
  421. const Pref* PREF_MAX_UPLOAD_LIMIT = makePref("max-upload-limit");
  422. // values: a string that your file system recognizes as a file name.
  423. const Pref* PREF_TORRENT_FILE = makePref("torrent-file");
  424. // values: 1*digit
  425. const Pref* PREF_LISTEN_PORT = makePref("listen-port");
  426. // values: true | false | mem
  427. const Pref* PREF_FOLLOW_TORRENT = makePref("follow-torrent");
  428. // values: 1*digit * = makePref( = makePref(,|-) 1*digit);
  429. const Pref* PREF_SELECT_FILE = makePref("select-file");
  430. // values: 1*digit
  431. const Pref* PREF_SEED_TIME = makePref("seed-time");
  432. // values: 1*digit ['.' [ 1*digit ] ]
  433. const Pref* PREF_SEED_RATIO = makePref("seed-ratio");
  434. // values: 1*digit
  435. const Pref* PREF_BT_KEEP_ALIVE_INTERVAL = makePref("bt-keep-alive-interval");
  436. // values: a string, less than or equals to 20 bytes length
  437. const Pref* PREF_PEER_ID_PREFIX = makePref("peer-id-prefix");
  438. // values: true | false
  439. const Pref* PREF_ENABLE_PEER_EXCHANGE = makePref("enable-peer-exchange");
  440. // values: true | false
  441. const Pref* PREF_ENABLE_DHT = makePref("enable-dht");
  442. // values: a string
  443. const Pref* PREF_DHT_LISTEN_ADDR = makePref("dht-listen-addr");
  444. // values: 1*digit
  445. const Pref* PREF_DHT_LISTEN_PORT = makePref("dht-listen-port");
  446. // values: a string
  447. const Pref* PREF_DHT_ENTRY_POINT_HOST = makePref("dht-entry-point-host");
  448. // values: 1*digit
  449. const Pref* PREF_DHT_ENTRY_POINT_PORT = makePref("dht-entry-point-port");
  450. // values: a string = makePref(hostname:port);
  451. const Pref* PREF_DHT_ENTRY_POINT = makePref("dht-entry-point");
  452. // values: a string
  453. const Pref* PREF_DHT_FILE_PATH = makePref("dht-file-path");
  454. // values: true | false
  455. const Pref* PREF_ENABLE_DHT6 = makePref("enable-dht6");
  456. // values: a string
  457. const Pref* PREF_DHT_LISTEN_ADDR6 = makePref("dht-listen-addr6");
  458. // values: a string
  459. const Pref* PREF_DHT_ENTRY_POINT_HOST6 = makePref("dht-entry-point-host6");
  460. // values: 1*digit
  461. const Pref* PREF_DHT_ENTRY_POINT_PORT6 = makePref("dht-entry-point-port6");
  462. // values: a string = makePref(hostname:port)
  463. const Pref* PREF_DHT_ENTRY_POINT6 = makePref("dht-entry-point6");
  464. // values: a string
  465. const Pref* PREF_DHT_FILE_PATH6 = makePref("dht-file-path6");
  466. // values: plain | arc4
  467. const Pref* PREF_BT_MIN_CRYPTO_LEVEL = makePref("bt-min-crypto-level");
  468. // values:: true | false
  469. const Pref* PREF_BT_REQUIRE_CRYPTO = makePref("bt-require-crypto");
  470. // values: 1*digit
  471. const Pref* PREF_BT_REQUEST_PEER_SPEED_LIMIT = makePref("bt-request-peer-speed-limit");
  472. // values: 1*digit
  473. const Pref* PREF_BT_MAX_OPEN_FILES = makePref("bt-max-open-files");
  474. // values: true | false
  475. const Pref* PREF_BT_SEED_UNVERIFIED = makePref("bt-seed-unverified");
  476. // values: true | false
  477. const Pref* PREF_BT_HASH_CHECK_SEED = makePref("bt-hash-check-seed");
  478. // values: 1*digit
  479. const Pref* PREF_BT_MAX_PEERS = makePref("bt-max-peers");
  480. // values: a string = makePref(IP address)
  481. const Pref* PREF_BT_EXTERNAL_IP = makePref("bt-external-ip");
  482. // values: 1*digit '=' a string that your file system recognizes as a file name.
  483. const Pref* PREF_INDEX_OUT = makePref("index-out");
  484. // values: 1*digit
  485. const Pref* PREF_BT_TRACKER_INTERVAL = makePref("bt-tracker-interval");
  486. // values: 1*digit
  487. const Pref* PREF_BT_STOP_TIMEOUT = makePref("bt-stop-timeout");
  488. // values: head[=SIZE]|tail[=SIZE], ...
  489. const Pref* PREF_BT_PRIORITIZE_PIECE = makePref("bt-prioritize-piece");
  490. // values: true | false
  491. const Pref* PREF_BT_SAVE_METADATA = makePref("bt-save-metadata");
  492. // values: true | false
  493. const Pref* PREF_BT_METADATA_ONLY = makePref("bt-metadata-only");
  494. // values: true | false
  495. const Pref* PREF_BT_ENABLE_LPD = makePref("bt-enable-lpd");
  496. // values: string
  497. const Pref* PREF_BT_LPD_INTERFACE = makePref("bt-lpd-interface");
  498. // values: 1*digit
  499. const Pref* PREF_BT_TRACKER_TIMEOUT = makePref("bt-tracker-timeout");
  500. // values: 1*digit
  501. const Pref* PREF_BT_TRACKER_CONNECT_TIMEOUT = makePref("bt-tracker-connect-timeout");
  502. // values: 1*digit
  503. const Pref* PREF_DHT_MESSAGE_TIMEOUT = makePref("dht-message-timeout");
  504. // values: string
  505. const Pref* PREF_ON_BT_DOWNLOAD_COMPLETE = makePref("on-bt-download-complete");
  506. // values: string
  507. const Pref* PREF_BT_TRACKER = makePref("bt-tracker");
  508. // values: string
  509. const Pref* PREF_BT_EXCLUDE_TRACKER = makePref("bt-exclude-tracker");
  510. // values: true | false
  511. const Pref* PREF_BT_REMOVE_UNSELECTED_FILE =
  512. makePref("bt-remove-unselected-file");
  513. /**
  514. * Metalink related preferences
  515. */
  516. // values: a string that your file system recognizes as a file name.
  517. const Pref* PREF_METALINK_FILE = makePref("metalink-file");
  518. // values: a string
  519. const Pref* PREF_METALINK_VERSION = makePref("metalink-version");
  520. // values: a string
  521. const Pref* PREF_METALINK_LANGUAGE = makePref("metalink-language");
  522. // values: a string
  523. const Pref* PREF_METALINK_OS = makePref("metalink-os");
  524. // values: a string
  525. const Pref* PREF_METALINK_LOCATION = makePref("metalink-location");
  526. // values: true | false | mem
  527. const Pref* PREF_FOLLOW_METALINK = makePref("follow-metalink");
  528. // values: http | https | ftp | none
  529. const Pref* PREF_METALINK_PREFERRED_PROTOCOL = makePref("metalink-preferred-protocol");
  530. // values: true | false
  531. const Pref* PREF_METALINK_ENABLE_UNIQUE_PROTOCOL = makePref("metalink-enable-unique-protocol");
  532. const Pref* PREF_METALINK_BASE_URI = makePref("metalink-base-uri");
  533. } // namespace aria2