SyntaxHighlighter

2009/06/09

BitTorrent BEP 5 Summary

I summarized BEP 5 as the below table.
Transaction Name Type Key Value Example Notes
ping query DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" q "q"
"q" ping "ping"
"a" DICTIONARY "id" <querying node ID> "I'M_QUERYING_TO_YOU." 20Bytes chars.
response DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" r "r"
"r" DICTIONARY "id" <queried node ID> "I_AM_A_QUERIED_NODE." 20Bytes chars.
find_node (look up & join) query DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" q "q"
"q" find_node "find_node"
"a" DICTIONARY "id" <querying node ID> "I'M_QUERYING_TO_YOU." 20Bytes chars.
"target" <TARGET_NODE> "A_TARGET_NODE_'S_ID." 20Bytes chars.
response DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" r "r"
"r" DICTIONARY "id" <queried node ID> "I_AM_A_QUERIED_NODE." 20Bytes chars.
"nodes" <(several up to K) compact node information> "<20 bytes node 01 ID><4 bytes node 01 IP address><2 bytes node01 UDP port><20 bytes node 02 ID><4 bytes node02 IP address><2 bytes node02 UDP port>...<20 bytes nodeK ID><4 bytes nodeK IP address><2 bytes nodeK UDP port>" 26bytes length data for each entry. The number of entries is up to K. Each contact information is 26 bytes length: "Contact information for peers is encoded as a 6-byte string. Also known as "Compact IP-address/port info" the 4-byte IP address is in network byte order with the 2 byte port in network byte order concatenated onto the end." This response is returned only when the queried node has the peers information related to the specified torrent. Also known as "Compact node info" the 20-byte Node ID in network byte order has the compact IP-address/port info concatenated to the end respond with a key "nodes" and value of a string containing the compact node info for the target node or the K (8) closest good nodes in its own routing table.
get_peers (get) query DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" q "q"
"q" get_peers "get_peers"
"a" DICTIONARY "id" <querying node ID> "I'M_QUERYING_TO_YOU." 20Bytes chars.
"info_hash" <torrent info_hash> "INFO_HASH_OF_TORRENT" 20Bytes chars.
response (1) DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" r "r"
"r" DICTIONARY "id" <queried node ID> "I_AM_A_QUERIED_NODE." 20Bytes chars.
"token" <token_string> "AUTH_TOKEN" A short binary string for a future consecutive query.
"values" LIST <Contact information for peer1,Contact information for peer2, ...> <"PEER01_IP_PORT","PEER01_IP_PORT", ...> Each peer information contains 6 bytes length data which is IP address and Port.
response (2) DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" r "r"
"r" DICTIONARY "id" <queried node ID> "I_AM_A_QUERIED_NODE." 20Bytes chars.
"token" <token_string> "AUTH_TOKEN" A short binary string for a future consecutive query.
"nodes" LIST <(several up to K) compact node information> "<20 bytes node 01 ID><4 bytes node 01 IP address><2 bytes node01 UDP port><20 bytes node 02 ID><4 bytes node02 IP address><2 bytes node02 UDP port>...<20 bytes nodeK ID><4 bytes nodeK IP address><2 bytes nodeK UDP port>" 26bytes length data for each entry. The number of entries is up to K. Each contact information is 26 bytes length: "Contact information for peers is encoded as a 6-byte string. Also known as "Compact IP-address/port info" the 4-byte IP address is in network byte order with the 2 byte port in network byte order concatenated onto the end." This response is returned only when the queried node has the peers information related to the specified torrent. Also known as "Compact node info" the 20-byte Node ID in network byte order has the compact IP-address/port info concatenated to the end respond with a key "nodes" and value of a string containing the compact node info for the target node or the K (8) closest good nodes in its own routing table.
announce_peer (put) query DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" q "q"
"q" announce_peer "announce_peer"
"a" DICTIONARY "id" <querying node ID> "I'M_QUERYING_TO_YOU." 20Bytes chars.
"info_hash" <torrent info_hash> "INFO_HASH_OF_TORRENT" 20Bytes chars.
"token" <token_string> "AUTH_TOKEN" A short binary string contained in the previous response of get_peers
"port" <TCP port number> "6789" TCP port number binded for BitTorrent transport. The address is the source address of UDP packet including this query.
response DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" r "r"
"r" DICTIONARY "id" <queried node ID> "I_AM_A_QUERIED_NODE." 20Bytes chars.
ERROR(COMMON) response DICTIONARY "t" <transaction id> "AB" A Transaction ID of the message Usually 2byte chars
"y" e "e"
"e" LIST <error_code, error_msg> 201, "A Generic Error Ocurred" {201, Generic Error} {202, Server Error} {203, Protocol Error, such as a malformed packet, invalid arguments, or bad token} {204, Method Unknown}

0 件のコメント: