本文主要是介绍aria2的控制文件*.aria2的技术说明,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Technical Notes
This document describes additional technical information of aria2. The expected audience is developers.
本文档描述了aria2的其他技术信息。预期的受众是开发人员。
Control File (*.aria2) Format
The control file uses a binary format to store progress information of a download. Here is the diagram for each field:
控制文件使用二进制格式来存储下载的进度信息。下面是每个字段的图:
0 1 2 30 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+---+-------+-------+-------------------------------------------+
|VER| EXT |INFO |INFO HASH ... |
|(2)| (4) |HASH | (INFO HASH LENGTH) |
| | |LENGTH | |
| | | (4) | |
+---+---+---+-------+---+---------------+-------+---------------+
|PIECE |TOTAL LENGTH |UPLOAD LENGTH |BIT- |BITFIELD ... |
|LENGTH | (8) | (8) |FIELD | (BITFIELD |
| (4) | | |LENGTH | LENGTH) |
| | | | (4) | |
+-------+-------+-------+-------+-------+-------+---------------+
|NUM |INDEX |LENGTH |PIECE |PIECE BITFIELD ... |
|IN- | (4) | (4) |BIT- | (PIECE BITFIELD LENGTH) |
|FLIGHT | | |FIELD | |
|PIECE | | |LENGTH | |
| (4) | | | (4) | |
+-------+-------+-------+-------+-------------------------------+^ ^| |+-------------------------------------------------------+Repeated in (NUM IN-FLIGHT) PIECE times
- Should be either version 0(0x0000) or version 1(0x0001). In version 1, all multi-byte integers are saved in network byte order(big endian). In version 0, all multi-byte integers are saved in host byte order. aria2 1.4.1 can read both versions and only writes a control file in version 1 format. version 0 support will be disappear in the future version.
- 应为版本0(0x0000)或版本1(0x0001)。 在版本1中,所有多字节整数以网络字节顺序(大字节序)保存。 在版本0中,所有多字节整数以主机字节顺序保存。 aria2 1.4.1可以读取这两个版本,并且只写入版本1格式的控制文件。 版本0支持将在以后的版本中消失。
-
- If LSB is 1(i.e.
EXT[3]&1 == 1
), aria2 checks whether the saved !InfoHash and current downloading one are the same. If they are not the same, an exception is thrown. This is called "infoHashCheck" extension. - 如果LSB为1(即),aria2将检查保存的!InfoHash和当前下载的信息是否相同。如果它们不相同,则抛出异常。这被称为“infoHashCheck”扩展。
EXT[3]&1 == 1
-
- The length of InfoHash that is located after this field. If "infoHashCheck" extension is enabled, if this value is 0, then an exception is thrown. For http/ftp downloads, this value should be 0.
- 位于此字段后面的InfoHash的长度。 如果启用了“infoHashCheck”扩展,如果此值为0,则抛出异常。 对于http / ftp下载,此值应为0。
-
- BitTorrent InfoHash.
- The length of the piece.
- The total length of the download.
- The uploaded length in this download.
- The length of bitfield.
- This is the bitfield which represents current download progress.
- The number of in-flight pieces. These piece is not marked 'downloaded' in the bitfield, but it has at least one downloaded chunk.
VER
(VERSION): 2 bytes EXT
(EXTENSION): 4 bytes INFO HASH LENGTH
: 4 bytes INFO HASH
: (INFO HASH LENGTH)
bytes PIECE LENGTH
: 4 bytes TOTAL LENGTH
: 8 bytes UPLOAD LENGTH
: 8 bytes BITFIELD LENGTH
: 4 bytes BITFIELD
: (BITFIELD LENGTH)
bytes NUM IN-FLIGHT PIECE
: 4 bytes The following 4 fields are repeated in (NUM IN-FLIGHT PIECE)
times.
- The index of the piece.
- The length of the piece.
- The length of bitfield of this piece.
- The bitfield of this piece. The each bit represents 16KiB chunk.
-
INDEX
: 4 bytes LENGTH
: 4 bytes PIECE BITFIELD LENGTH
: 4 bytes PIECE BITFIELD
: (PIECE BITFIELD LENGTH)
bytes 这篇关于aria2的控制文件*.aria2的技术说明的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!