1 | Like normal bittorrent messages, all azureus messages begin with the |
---|
2 | length of the rest of the message in bytes ad a 4-byte integer in |
---|
3 | network byte order. This length does not include the 4 bytes for the |
---|
4 | length itself. |
---|
5 | |
---|
6 | After that is another 4-byte network byte order integer containing the |
---|
7 | length of the following message id string in bytes, then the message |
---|
8 | id string, then a 1 byte integer containing the protocol version. The |
---|
9 | current version is 1. |
---|
10 | |
---|
11 | The message payload format for various message IDs is below. |
---|
12 | |
---|
13 | AZ_HANDSHAKE |
---|
14 | payload is a bencoded dictionary: |
---|
15 | identity: |
---|
16 | string, 20 bytes client identity. The identity should be |
---|
17 | calculated once on startup similarly to the peer_id, except |
---|
18 | than each byte should be completely random and not limited to |
---|
19 | alphanumeric characters. |
---|
20 | client: |
---|
21 | string, client name. eg: Transmission |
---|
22 | version: |
---|
23 | string, client version. eg: 0.7 |
---|
24 | tcp_port: (optional) |
---|
25 | int, tcp port for incoming peer connections. |
---|
26 | udp_port: (optional) |
---|
27 | int, udp listening port (what is this used for exactly?) |
---|
28 | udp2_port: (optional) |
---|
29 | int, udp non-data listening port (I don't know what this is for either) |
---|
30 | handshake_type: (optional) |
---|
31 | int, 0 for plain or 1 for crypto |
---|
32 | messages: |
---|
33 | list, each item is a dict for the supported messages and versions: |
---|
34 | id: |
---|
35 | string, message id |
---|
36 | ver: |
---|
37 | string, 1 byte version, currently 1 |
---|
38 | |
---|
39 | AZ_PEER_EXCHANGE |
---|
40 | these messages should be sent approximately once a minute (is this true?) |
---|
41 | payload is a bencoded dictionary: |
---|
42 | infohash: |
---|
43 | string, 20 byte info_hash for the torrent |
---|
44 | added: |
---|
45 | list, each item is a 6 byte string for an IP address and port |
---|
46 | added since the last peer exchange message. |
---|
47 | added_HST: |
---|
48 | string, one byte for each item in the added list. |
---|
49 | Each byte is the handshake type (0 plain, 1 crypto) for the matching |
---|
50 | item in the added list. |
---|
51 | added_UDP: |
---|
52 | string, two bytes for each item in the added list. |
---|
53 | Each pair of bytes is the UDP port (network byte order) for the |
---|
54 | matching item in the added list. |
---|
55 | dropped: |
---|
56 | same format as added, contains peers dropped since last peer exchange |
---|
57 | dropped_HST: |
---|
58 | same format as added_HST |
---|
59 | dropped_UDP: |
---|
60 | same format as added_UDP |
---|
61 | |
---|
62 | BT_KEEP_ALIVE |
---|
63 | zero-length payload |
---|
64 | |
---|
65 | The following messages all have the same payload as the corresponding |
---|
66 | bittorrent message, not including the bittorrent 4-byte length and |
---|
67 | 1-byte id. |
---|
68 | |
---|
69 | BT_CHOKE - 0 |
---|
70 | BT_UNCHOKE - 1 |
---|
71 | BT_INTERESTED - 2 |
---|
72 | BT_UNINTERESTED - 3 |
---|
73 | BT_HAVE - 4 |
---|
74 | BT_BITFIELD - 5 |
---|
75 | BT_REQUEST - 6 |
---|
76 | BT_PIECE - 7 |
---|
77 | BT_CANCEL - 8 |
---|