source: branches/pex/misc/azureus.txt @ 1540

Last change on this file since 1540 was 1540, checked in by joshe, 15 years ago

Implement Azureus peer protocol, including PEX message.
Implement extended messages, including uTorrent PEX.

File size: 2.7 KB
Line 
1Like normal bittorrent messages, all azureus messages begin with the
2length of the rest of the message in bytes ad a 4-byte integer in
3network byte order.  This length does not include the 4 bytes for the
4length itself.
5
6After that is another 4-byte network byte order integer containing the
7length of the following message id string in bytes, then the message
8id string, then a 1 byte integer containing the protocol version.  The
9current version is 1.
10
11The message payload format for various message IDs is below.
12
13AZ_HANDSHAKE
14payload 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
39AZ_PEER_EXCHANGE
40these messages should be sent approximately once a minute (is this true?)
41payload 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
62BT_KEEP_ALIVE
63zero-length payload
64
65The following messages all have the same payload as the corresponding
66bittorrent message, not including the bittorrent 4-byte length and
671-byte id.
68
69BT_CHOKE        - 0
70BT_UNCHOKE      - 1
71BT_INTERESTED   - 2
72BT_UNINTERESTED - 3
73BT_HAVE         - 4
74BT_BITFIELD     - 5
75BT_REQUEST      - 6
76BT_PIECE        - 7
77BT_CANCEL       - 8
Note: See TracBrowser for help on using the repository browser.