prefs.cc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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_EPOLL("epoll");
  141. const std::string V_KQUEUE("kqueue");
  142. const std::string V_PORT("port");
  143. const std::string V_POLL("poll");
  144. const std::string V_SELECT("select");
  145. const std::string V_BINARY("binary");
  146. const std::string V_ASCII("ascii");
  147. const std::string V_GET("get");
  148. const std::string V_TUNNEL("tunnel");
  149. const std::string V_PLAIN("plain");
  150. const std::string V_ARC4("arc4");
  151. const std::string V_HTTP("http");
  152. const std::string V_HTTPS("https");
  153. const std::string V_FTP("ftp");
  154. const Pref* PREF_VERSION = makePref("version");
  155. const Pref* PREF_HELP = makePref("help");
  156. /**
  157. * General preferences
  158. */
  159. // values: 1*digit
  160. const Pref* PREF_TIMEOUT = makePref("timeout");
  161. // values: 1*digit
  162. const Pref* PREF_DNS_TIMEOUT = makePref("dns-timeout");
  163. // values: 1*digit
  164. const Pref* PREF_CONNECT_TIMEOUT = makePref("connect-timeout");
  165. // values: 1*digit
  166. const Pref* PREF_MAX_TRIES = makePref("max-tries");
  167. // values: 1*digit
  168. const Pref* PREF_AUTO_SAVE_INTERVAL = makePref("auto-save-interval");
  169. // values: a string that your file system recognizes as a file name.
  170. const Pref* PREF_LOG = makePref("log");
  171. // values: a string that your file system recognizes as a directory.
  172. const Pref* PREF_DIR = makePref("dir");
  173. // values: a string that your file system recognizes as a file name.
  174. const Pref* PREF_OUT = makePref("out");
  175. // values: 1*digit
  176. const Pref* PREF_SPLIT = makePref("split");
  177. // value: true | false
  178. const Pref* PREF_DAEMON = makePref("daemon");
  179. // value: a string
  180. const Pref* PREF_REFERER = makePref("referer");
  181. // value: 1*digit
  182. const Pref* PREF_LOWEST_SPEED_LIMIT = makePref("lowest-speed-limit");
  183. // value: 1*digit
  184. const Pref* PREF_PIECE_LENGTH = makePref("piece-length");
  185. // value: 1*digit
  186. const Pref* PREF_MAX_OVERALL_DOWNLOAD_LIMIT = makePref("max-overall-download-limit");
  187. // value: 1*digit
  188. const Pref* PREF_MAX_DOWNLOAD_LIMIT = makePref("max-download-limit");
  189. // value: 1*digit
  190. const Pref* PREF_STARTUP_IDLE_TIME = makePref("startup-idle-time");
  191. // value: prealloc | fallc | none
  192. const Pref* PREF_FILE_ALLOCATION = makePref("file-allocation");
  193. // value: 1*digit
  194. const Pref* PREF_NO_FILE_ALLOCATION_LIMIT = makePref("no-file-allocation-limit");
  195. // value: true | false
  196. const Pref* PREF_ALLOW_OVERWRITE = makePref("allow-overwrite");
  197. // value: true | false
  198. const Pref* PREF_REALTIME_CHUNK_CHECKSUM = makePref("realtime-chunk-checksum");
  199. // value: true | false
  200. const Pref* PREF_CHECK_INTEGRITY = makePref("check-integrity");
  201. // value: string that your file system recognizes as a file name.
  202. const Pref* PREF_NETRC_PATH = makePref("netrc-path");
  203. // value:
  204. const Pref* PREF_CONTINUE = makePref("continue");
  205. // value:
  206. const Pref* PREF_NO_NETRC = makePref("no-netrc");
  207. // value: 1*digit
  208. const Pref* PREF_MAX_DOWNLOADS = makePref("max-downloads");
  209. // value: string that your file system recognizes as a file name.
  210. const Pref* PREF_INPUT_FILE = makePref("input-file");
  211. // value: true | false
  212. const Pref* PREF_DEFERRED_INPUT = makePref("deferred-input");
  213. // value: 1*digit
  214. const Pref* PREF_MAX_CONCURRENT_DOWNLOADS = makePref("max-concurrent-downloads");
  215. // value: true | false
  216. const Pref* PREF_FORCE_SEQUENTIAL = makePref("force-sequential");
  217. // value: true | false
  218. const Pref* PREF_AUTO_FILE_RENAMING = makePref("auto-file-renaming");
  219. // value: true | false
  220. const Pref* PREF_PARAMETERIZED_URI = makePref("parameterized-uri");
  221. // value: true | false
  222. const Pref* PREF_ENABLE_DIRECT_IO = makePref("enable-direct-io");
  223. // value: true | false
  224. const Pref* PREF_ALLOW_PIECE_LENGTH_CHANGE = makePref("allow-piece-length-change");
  225. // value: true | false
  226. const Pref* PREF_NO_CONF = makePref("no-conf");
  227. // value: string
  228. const Pref* PREF_CONF_PATH = makePref("conf-path");
  229. // value: 1*digit
  230. const Pref* PREF_STOP = makePref("stop");
  231. // value: true | false
  232. const Pref* PREF_QUIET = makePref("quiet");
  233. // value: true | false
  234. const Pref* PREF_ASYNC_DNS = makePref("async-dns");
  235. // value: 1*digit
  236. const Pref* PREF_SUMMARY_INTERVAL = makePref("summary-interval");
  237. // value: debug, info, notice, warn, error
  238. const Pref* PREF_LOG_LEVEL = makePref("log-level");
  239. // value: debug, info, notice, warn, error
  240. const Pref* PREF_CONSOLE_LOG_LEVEL = makePref("console-log-level");
  241. // value: inorder | feedback | adaptive
  242. const Pref* PREF_URI_SELECTOR = makePref("uri-selector");
  243. // value: 1*digit
  244. const Pref* PREF_SERVER_STAT_TIMEOUT = makePref("server-stat-timeout");
  245. // value: string that your file system recognizes as a file name.
  246. const Pref* PREF_SERVER_STAT_IF = makePref("server-stat-if");
  247. // value: string that your file system recognizes as a file name.
  248. const Pref* PREF_SERVER_STAT_OF = makePref("server-stat-of");
  249. // value: true | false
  250. const Pref* PREF_REMOTE_TIME = makePref("remote-time");
  251. // value: 1*digit
  252. const Pref* PREF_MAX_FILE_NOT_FOUND = makePref("max-file-not-found");
  253. // value: epoll | select
  254. const Pref* PREF_EVENT_POLL = makePref("event-poll");
  255. // value: true | false
  256. const Pref* PREF_ENABLE_RPC = makePref("enable-rpc");
  257. // value: 1*digit
  258. const Pref* PREF_RPC_LISTEN_PORT = makePref("rpc-listen-port");
  259. // value: string
  260. const Pref* PREF_RPC_USER = makePref("rpc-user");
  261. // value: string
  262. const Pref* PREF_RPC_PASSWD = makePref("rpc-passwd");
  263. // value: 1*digit
  264. const Pref* PREF_RPC_MAX_REQUEST_SIZE = makePref("rpc-max-request-size");
  265. // value: true | false
  266. const Pref* PREF_RPC_LISTEN_ALL = makePref("rpc-listen-all");
  267. // value: true | false
  268. const Pref* PREF_RPC_ALLOW_ORIGIN_ALL = makePref("rpc-allow-origin-all");
  269. // value: string that your file system recognizes as a file name.
  270. const Pref* PREF_RPC_CERTIFICATE = makePref("rpc-certificate");
  271. // value: string that your file system recognizes as a file name.
  272. const Pref* PREF_RPC_PRIVATE_KEY = makePref("rpc-private-key");
  273. // value: true | false
  274. const Pref* PREF_RPC_SECURE = makePref("rpc-secure");
  275. // value: true | false
  276. const Pref* PREF_RPC_SAVE_UPLOAD_METADATA = makePref("rpc-save-upload-metadata");
  277. // value: true | false
  278. const Pref* PREF_DRY_RUN = makePref("dry-run");
  279. // value: true | false
  280. const Pref* PREF_REUSE_URI = makePref("reuse-uri");
  281. // value: string
  282. const Pref* PREF_ON_DOWNLOAD_START = makePref("on-download-start");
  283. const Pref* PREF_ON_DOWNLOAD_PAUSE = makePref("on-download-pause");
  284. const Pref* PREF_ON_DOWNLOAD_STOP = makePref("on-download-stop");
  285. const Pref* PREF_ON_DOWNLOAD_COMPLETE = makePref("on-download-complete");
  286. const Pref* PREF_ON_DOWNLOAD_ERROR = makePref("on-download-error");
  287. // value: string
  288. const Pref* PREF_INTERFACE = makePref("interface");
  289. // value: true | false
  290. const Pref* PREF_DISABLE_IPV6 = makePref("disable-ipv6");
  291. // value: true | false
  292. const Pref* PREF_HUMAN_READABLE = makePref("human-readable");
  293. // value: true | false
  294. const Pref* PREF_REMOVE_CONTROL_FILE = makePref("remove-control-file");
  295. // value: true | false
  296. const Pref* PREF_ALWAYS_RESUME = makePref("always-resume");
  297. // value: 1*digit
  298. const Pref* PREF_MAX_RESUME_FAILURE_TRIES = makePref("max-resume-failure-tries");
  299. // value: string that your file system recognizes as a file name.
  300. const Pref* PREF_SAVE_SESSION = makePref("save-session");
  301. // value: 1*digit
  302. const Pref* PREF_MAX_CONNECTION_PER_SERVER = makePref("max-connection-per-server");
  303. // value: 1*digit
  304. const Pref* PREF_MIN_SPLIT_SIZE = makePref("min-split-size");
  305. // value: true | false
  306. const Pref* PREF_CONDITIONAL_GET = makePref("conditional-get");
  307. // value: true | false
  308. const Pref* PREF_SELECT_LEAST_USED_HOST = makePref("select-least-used-host");
  309. // value: true | false
  310. const Pref* PREF_ENABLE_ASYNC_DNS6 = makePref("enable-async-dns6");
  311. // value: 1*digit
  312. const Pref* PREF_MAX_DOWNLOAD_RESULT = makePref("max-download-result");
  313. // value: 1*digit
  314. const Pref* PREF_RETRY_WAIT = makePref("retry-wait");
  315. // value: string
  316. const Pref* PREF_ASYNC_DNS_SERVER = makePref("async-dns-server");
  317. // value: true | false
  318. const Pref* PREF_SHOW_CONSOLE_READOUT = makePref("show-console-readout");
  319. // value: default | inorder
  320. const Pref* PREF_STREAM_PIECE_SELECTOR = makePref("stream-piece-selector");
  321. // value: true | false
  322. const Pref* PREF_TRUNCATE_CONSOLE_READOUT = makePref("truncate-console-readout");
  323. // value: true | false
  324. const Pref* PREF_PAUSE = makePref("pause");
  325. // value: default | full
  326. const Pref* PREF_DOWNLOAD_RESULT = makePref("download-result");
  327. // value: true | false
  328. const Pref* PREF_HASH_CHECK_ONLY = makePref("hash-check-only");
  329. // values: hashType=digest
  330. const Pref* PREF_CHECKSUM = makePref("checksum");
  331. // value: pid
  332. const Pref* PREF_STOP_WITH_PROCESS = makePref("stop-with-process");
  333. // value: true | false
  334. const Pref* PREF_ENABLE_MMAP = makePref("enable-mmap");
  335. // value: true | false
  336. const Pref* PREF_FORCE_SAVE = makePref("force-save");
  337. // value: 1*digit
  338. const Pref* PREF_DISK_CACHE = makePref("disk-cache");
  339. // value: string
  340. const Pref* PREF_GID = makePref("gid");
  341. /**
  342. * FTP related preferences
  343. */
  344. const Pref* PREF_FTP_USER = makePref("ftp-user");
  345. const Pref* PREF_FTP_PASSWD = makePref("ftp-passwd");
  346. // values: binary | ascii
  347. const Pref* PREF_FTP_TYPE = makePref("ftp-type");
  348. // values: true | false
  349. const Pref* PREF_FTP_PASV = makePref("ftp-pasv");
  350. // values: true | false
  351. const Pref* PREF_FTP_REUSE_CONNECTION = makePref("ftp-reuse-connection");
  352. /**
  353. * HTTP related preferences
  354. */
  355. const Pref* PREF_HTTP_USER = makePref("http-user");
  356. const Pref* PREF_HTTP_PASSWD = makePref("http-passwd");
  357. // values: string
  358. const Pref* PREF_USER_AGENT = makePref("user-agent");
  359. // value: string that your file system recognizes as a file name.
  360. const Pref* PREF_LOAD_COOKIES = makePref("load-cookies");
  361. // value: string that your file system recognizes as a file name.
  362. const Pref* PREF_SAVE_COOKIES = makePref("save-cookies");
  363. // values: true | false
  364. const Pref* PREF_ENABLE_HTTP_KEEP_ALIVE = makePref("enable-http-keep-alive");
  365. // values: true | false
  366. const Pref* PREF_ENABLE_HTTP_PIPELINING = makePref("enable-http-pipelining");
  367. // value: 1*digit
  368. const Pref* PREF_MAX_HTTP_PIPELINING = makePref("max-http-pipelining");
  369. // value: string
  370. const Pref* PREF_HEADER = makePref("header");
  371. // value: string that your file system recognizes as a file name.
  372. const Pref* PREF_CERTIFICATE = makePref("certificate");
  373. // value: string that your file system recognizes as a file name.
  374. const Pref* PREF_PRIVATE_KEY = makePref("private-key");
  375. // value: string that your file system recognizes as a file name.
  376. const Pref* PREF_CA_CERTIFICATE = makePref("ca-certificate");
  377. // value: true | false
  378. const Pref* PREF_CHECK_CERTIFICATE = makePref("check-certificate");
  379. // value: true | false
  380. const Pref* PREF_USE_HEAD = makePref("use-head");
  381. // value: true | false
  382. const Pref* PREF_HTTP_AUTH_CHALLENGE = makePref("http-auth-challenge");
  383. // value: true | false
  384. const Pref* PREF_HTTP_NO_CACHE = makePref("http-no-cache");
  385. // value: true | false
  386. const Pref* PREF_HTTP_ACCEPT_GZIP = makePref("http-accept-gzip");
  387. /**
  388. * Proxy related preferences
  389. */
  390. const Pref* PREF_HTTP_PROXY = makePref("http-proxy");
  391. const Pref* PREF_HTTPS_PROXY = makePref("https-proxy");
  392. const Pref* PREF_FTP_PROXY = makePref("ftp-proxy");
  393. const Pref* PREF_ALL_PROXY = makePref("all-proxy");
  394. // values: comma separeted hostname or domain
  395. const Pref* PREF_NO_PROXY = makePref("no-proxy");
  396. // values: get | tunnel
  397. const Pref* PREF_PROXY_METHOD = makePref("proxy-method");
  398. const Pref* PREF_HTTP_PROXY_USER = makePref("http-proxy-user");
  399. const Pref* PREF_HTTP_PROXY_PASSWD = makePref("http-proxy-passwd");
  400. const Pref* PREF_HTTPS_PROXY_USER = makePref("https-proxy-user");
  401. const Pref* PREF_HTTPS_PROXY_PASSWD = makePref("https-proxy-passwd");
  402. const Pref* PREF_FTP_PROXY_USER = makePref("ftp-proxy-user");
  403. const Pref* PREF_FTP_PROXY_PASSWD = makePref("ftp-proxy-passwd");
  404. const Pref* PREF_ALL_PROXY_USER = makePref("all-proxy-user");
  405. const Pref* PREF_ALL_PROXY_PASSWD = makePref("all-proxy-passwd");
  406. /**
  407. * BitTorrent related preferences
  408. */
  409. // values: 1*digit
  410. const Pref* PREF_PEER_CONNECTION_TIMEOUT = makePref("peer-connection-timeout");
  411. // values: 1*digit
  412. const Pref* PREF_BT_TIMEOUT = makePref("bt-timeout");
  413. // values: 1*digit
  414. const Pref* PREF_BT_REQUEST_TIMEOUT = makePref("bt-request-timeout");
  415. // values: true | false
  416. const Pref* PREF_SHOW_FILES = makePref("show-files");
  417. // values: 1*digit
  418. const Pref* PREF_MAX_OVERALL_UPLOAD_LIMIT = makePref("max-overall-upload-limit");
  419. // values: 1*digit
  420. const Pref* PREF_MAX_UPLOAD_LIMIT = makePref("max-upload-limit");
  421. // values: a string that your file system recognizes as a file name.
  422. const Pref* PREF_TORRENT_FILE = makePref("torrent-file");
  423. // values: 1*digit
  424. const Pref* PREF_LISTEN_PORT = makePref("listen-port");
  425. // values: true | false | mem
  426. const Pref* PREF_FOLLOW_TORRENT = makePref("follow-torrent");
  427. // values: 1*digit * = makePref( = makePref(,|-) 1*digit);
  428. const Pref* PREF_SELECT_FILE = makePref("select-file");
  429. // values: 1*digit
  430. const Pref* PREF_SEED_TIME = makePref("seed-time");
  431. // values: 1*digit ['.' [ 1*digit ] ]
  432. const Pref* PREF_SEED_RATIO = makePref("seed-ratio");
  433. // values: 1*digit
  434. const Pref* PREF_BT_KEEP_ALIVE_INTERVAL = makePref("bt-keep-alive-interval");
  435. // values: a string, less than or equals to 20 bytes length
  436. const Pref* PREF_PEER_ID_PREFIX = makePref("peer-id-prefix");
  437. // values: true | false
  438. const Pref* PREF_ENABLE_PEER_EXCHANGE = makePref("enable-peer-exchange");
  439. // values: true | false
  440. const Pref* PREF_ENABLE_DHT = makePref("enable-dht");
  441. // values: a string
  442. const Pref* PREF_DHT_LISTEN_ADDR = makePref("dht-listen-addr");
  443. // values: 1*digit
  444. const Pref* PREF_DHT_LISTEN_PORT = makePref("dht-listen-port");
  445. // values: a string
  446. const Pref* PREF_DHT_ENTRY_POINT_HOST = makePref("dht-entry-point-host");
  447. // values: 1*digit
  448. const Pref* PREF_DHT_ENTRY_POINT_PORT = makePref("dht-entry-point-port");
  449. // values: a string = makePref(hostname:port);
  450. const Pref* PREF_DHT_ENTRY_POINT = makePref("dht-entry-point");
  451. // values: a string
  452. const Pref* PREF_DHT_FILE_PATH = makePref("dht-file-path");
  453. // values: true | false
  454. const Pref* PREF_ENABLE_DHT6 = makePref("enable-dht6");
  455. // values: a string
  456. const Pref* PREF_DHT_LISTEN_ADDR6 = makePref("dht-listen-addr6");
  457. // values: a string
  458. const Pref* PREF_DHT_ENTRY_POINT_HOST6 = makePref("dht-entry-point-host6");
  459. // values: 1*digit
  460. const Pref* PREF_DHT_ENTRY_POINT_PORT6 = makePref("dht-entry-point-port6");
  461. // values: a string = makePref(hostname:port)
  462. const Pref* PREF_DHT_ENTRY_POINT6 = makePref("dht-entry-point6");
  463. // values: a string
  464. const Pref* PREF_DHT_FILE_PATH6 = makePref("dht-file-path6");
  465. // values: plain | arc4
  466. const Pref* PREF_BT_MIN_CRYPTO_LEVEL = makePref("bt-min-crypto-level");
  467. // values:: true | false
  468. const Pref* PREF_BT_REQUIRE_CRYPTO = makePref("bt-require-crypto");
  469. // values: 1*digit
  470. const Pref* PREF_BT_REQUEST_PEER_SPEED_LIMIT = makePref("bt-request-peer-speed-limit");
  471. // values: 1*digit
  472. const Pref* PREF_BT_MAX_OPEN_FILES = makePref("bt-max-open-files");
  473. // values: true | false
  474. const Pref* PREF_BT_SEED_UNVERIFIED = makePref("bt-seed-unverified");
  475. // values: true | false
  476. const Pref* PREF_BT_HASH_CHECK_SEED = makePref("bt-hash-check-seed");
  477. // values: 1*digit
  478. const Pref* PREF_BT_MAX_PEERS = makePref("bt-max-peers");
  479. // values: a string = makePref(IP address)
  480. const Pref* PREF_BT_EXTERNAL_IP = makePref("bt-external-ip");
  481. // values: 1*digit '=' a string that your file system recognizes as a file name.
  482. const Pref* PREF_INDEX_OUT = makePref("index-out");
  483. // values: 1*digit
  484. const Pref* PREF_BT_TRACKER_INTERVAL = makePref("bt-tracker-interval");
  485. // values: 1*digit
  486. const Pref* PREF_BT_STOP_TIMEOUT = makePref("bt-stop-timeout");
  487. // values: head[=SIZE]|tail[=SIZE], ...
  488. const Pref* PREF_BT_PRIORITIZE_PIECE = makePref("bt-prioritize-piece");
  489. // values: true | false
  490. const Pref* PREF_BT_SAVE_METADATA = makePref("bt-save-metadata");
  491. // values: true | false
  492. const Pref* PREF_BT_METADATA_ONLY = makePref("bt-metadata-only");
  493. // values: true | false
  494. const Pref* PREF_BT_ENABLE_LPD = makePref("bt-enable-lpd");
  495. // values: string
  496. const Pref* PREF_BT_LPD_INTERFACE = makePref("bt-lpd-interface");
  497. // values: 1*digit
  498. const Pref* PREF_BT_TRACKER_TIMEOUT = makePref("bt-tracker-timeout");
  499. // values: 1*digit
  500. const Pref* PREF_BT_TRACKER_CONNECT_TIMEOUT = makePref("bt-tracker-connect-timeout");
  501. // values: 1*digit
  502. const Pref* PREF_DHT_MESSAGE_TIMEOUT = makePref("dht-message-timeout");
  503. // values: string
  504. const Pref* PREF_ON_BT_DOWNLOAD_COMPLETE = makePref("on-bt-download-complete");
  505. // values: string
  506. const Pref* PREF_BT_TRACKER = makePref("bt-tracker");
  507. // values: string
  508. const Pref* PREF_BT_EXCLUDE_TRACKER = makePref("bt-exclude-tracker");
  509. // values: true | false
  510. const Pref* PREF_BT_REMOVE_UNSELECTED_FILE =
  511. makePref("bt-remove-unselected-file");
  512. /**
  513. * Metalink related preferences
  514. */
  515. // values: a string that your file system recognizes as a file name.
  516. const Pref* PREF_METALINK_FILE = makePref("metalink-file");
  517. // values: a string
  518. const Pref* PREF_METALINK_VERSION = makePref("metalink-version");
  519. // values: a string
  520. const Pref* PREF_METALINK_LANGUAGE = makePref("metalink-language");
  521. // values: a string
  522. const Pref* PREF_METALINK_OS = makePref("metalink-os");
  523. // values: a string
  524. const Pref* PREF_METALINK_LOCATION = makePref("metalink-location");
  525. // values: 1*digit
  526. const Pref* PREF_METALINK_SERVERS = makePref("metalink-servers");
  527. // values: true | false | mem
  528. const Pref* PREF_FOLLOW_METALINK = makePref("follow-metalink");
  529. // values: http | https | ftp | none
  530. const Pref* PREF_METALINK_PREFERRED_PROTOCOL = makePref("metalink-preferred-protocol");
  531. // values: true | false
  532. const Pref* PREF_METALINK_ENABLE_UNIQUE_PROTOCOL = makePref("metalink-enable-unique-protocol");
  533. const Pref* PREF_METALINK_BASE_URI = makePref("metalink-base-uri");
  534. } // namespace aria2