`
tiantian911
  • 浏览: 227166 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

UDP tracker protocol

阅读更多
留存。。以作参考。。
原文:http://xbtt.sourceforge.net/udp_tracker_protocol.html


UDP tracker protocol

Introduction

The UDP tracker protocol is a high-performance low-overhead BitTorrent tracker protocol. URLs for this protocol look like udp://tracker:port.

Azureus, XBT Client and XBT Tracker support this protocol.

All values are send in network byte order (big endian). Do not expect packets to be exactly of a certain size. Future extensions could increase the size of packets.

Set n to 0.
If no response is received after 60 * 2 ^ n seconds, resend the connect request and increase n.
If a response is received, reset n to 0.
HTTP vs UDP

    * Ethernet: 14 bytes
    * IP: 20 bytes
    * TCP: 20 bytes
    * UDP: 8 bytes

Protocol Packets Non-user User Total
HTTP 10 540 247 + 119 + 6 * N = 366 + 6 * N 906 + 6 * N
UDP 4 168 16 + 16 + 98 + 20 + 6 * N = 150 + 6 * N 318 + 6 * N
HTTP - UDP 6 372 216 588
HTTP / UDP 2.5 3.2 1.5 2.0

The UDP tracker protocol uses (less than) 50% of the bandwidth the HTTP tracker protocol uses. And because UDP is stateless, limits to the number of (open) TCP connections a router or server can handle, do not apply.
Structures

Before announcing or scraping, you have to obtain a connection ID.

   1. Choose a (random) transaction ID.
   2. Fill the connect input structure.
   3. Send the packet.

connect input Offset Size Name Value
0 64-bit integer connection_id 0x41727101980
8 32-bit integer action 0
12 32-bit integer transaction_id
16

   1. Receive the packet.
   2. Check whether the packet is at least 16 bytes.
   3. Check whether the transaction ID is equal to the one you chose.
   4. Check whether the action is connect.
   5. Store the connection ID for future use.

connect output Offset Size Name Value
0 32-bit integer action 0
4 32-bit integer transaction_id
8 64-bit integer connection_id
16

   1. Choose a (random) transaction ID.
   2. Fill the announce input structure.
   3. Send the packet.

announce input Offset Size Name Value
0 64-bit integer connection_id
8 32-bit integer action 1
12 32-bit integer transaction_id
16 20-byte string info_hash
36 20-byte string peer_id
56 64-bit integer downloaded
64 64-bit integer left
72 64-bit integer uploaded
80 32-bit integer event
84 32-bit integer IP address 0
88 32-bit integer key
92 32-bit integer num_want -1
96 16-bit integer port
98

   1. Receive the packet.
   2. Check whether the packet is at least 20 bytes.
   3. Check whether the transaction ID is equal to the one you chose.
   4. Check whether the action is announce.
   5. Do not announce again until interval seconds have passed or an event has happened.

announce output Offset Size Name Value
0 32-bit integer action 1
4 32-bit integer transaction_id
8 32-bit integer interval
12 32-bit integer leechers
16 32-bit integer seeders
20 + 6 * n 32-bit integer IP address
24 + 6 * n 16-bit integer TCP port
20 + 6 * N

Up to about 74 torrents can be scraped at once. A full scrape can't be done with this protocol.

   1. Choose a (random) transaction ID.
   2. Fill the scrape input structure.
   3. Send the packet.

scrape input Offset Size Name Value
0 64-bit integer connection_id
8 32-bit integer action 2
12 32-bit integer transaction_id
16 + 20 * n 20-byte string info_hash
16 + 20 * N

   1. Receive the packet.
   2. Check whether the packet is at least 8 bytes.
   3. Check whether the transaction ID is equal to the one you chose.
   4. Check whether the action is scrape.

scrape output Offset Size Name Value
0 32-bit integer action 2
4 32-bit integer transaction_id
8 + 12 * n 32-bit integer seeders
12 + 12 * n 32-bit integer completed
16 + 12 * n 32-bit integer leechers
8 + 12 * N

If the tracker encounters an error, it might send an error packet.

   1. Receive the packet.
   2. Check whether the packet is at least 8 bytes.
   3. Check whether the transaction ID is equal to the one you chose.

error output Offset Size Name Value
0 32-bit integer action 3
4 32-bit integer transaction_id
8 string message

If the tracker requires authentication, an authentication structure has to be appended to every packet you send to the tracker. The hash is the first 8 bytes of sha1(input + username + sha1(password)).
authenticate input Offset Size Name
0 8-byte zero-padded string username
8 8-byte string hash
16
Actions

    * 0: connect
    * 1: announce
    * 2: scrape
    * 3: error

Events

    * 0: none
    * 1: completed
    * 2: started
    * 3: stopped
0
0
分享到:
评论

相关推荐

    Bittorrent客户端etorrent.zip

    etorrent 是一个用Erlang语言开发的Bittorrent客户端,当前支持的 BEP: BEP 03 - The BitTorrent ... BEP 15 - UDP Tracker Protocol BEP 23 - Tracker Returns Compact Peer Lists. 标签:etorrent

    电驴eMule资料大全

    4. **UDP Tracker Protocol**:UDP追踪器协议,提高了连接速度和效率,减少了服务器负担。 5. **eDonkey Network**:eDonkey网络,是eMule最初的共享网络,采用客户端-服务器模式。 6. **Kad Network**:kad网络,是...

    BitTorrent-Tracker-Protocol:从跟踪器(UDP)获取种子信息

    状态:不完整(排序) 从跟踪器(UDP)获取种子信息 为了发现群中的其他对等方,客户端将UDP数据包发送给跟踪器,以宣布其存在。 请求和响应都很短。 如果使用TCP,则必须打开和关闭连接,这会带来额外的开销。 因此...

    openvr-tracker:通过udp广播的小型控制台应用程序

    UDP(User Datagram Protocol)是一种无连接的传输协议,相对于TCP而言,它更注重速度而非可靠性。在VR环境中,实时性至关重要,因此UDP常被用于低延迟的通信需求。 该控制台应用的工作原理是,它会周期性地广播...

    udp p2p的server和client

    UDP(User Datagram Protocol)是一种无连接的、不可靠的传输层协议,常用于实时数据传输,如音频、视频流媒体,以及对延迟敏感的游戏应用。P2P(Peer-to-Peer)网络则是一种分布式网络架构,其中每个节点既是服务器...

    torrent-tracker-scraper:用Python 3编写的UDP洪流跟踪器刮板库

    洪流追踪器 用Python 3编写的UDP洪流跟踪器抓取器 安装 pipenv install torrent-tracker-scraper pipenv shell 用法 传递信息哈希列表 from torrent_tracker_scraper import scraper ... 'tracker' : 'udp://exp

    udpt:轻量级UDP洪流跟踪器

    UDP(User Datagram Protocol)是一种无连接的传输层协议,常用于需要快速传输数据且对数据完整性要求不高的场合。在P2P网络中,尤其是BitTorrent协议,UDP跟踪器(Tracker)扮演了关键角色,它帮助协调客户端之间的...

    BitTorrent-5.0.9.zip

    5. **UDP Tracker Support**:除了传统的HTTP/HTTPS tracker之外,BitTorrent还支持基于UDP的追踪器,这可以提高追踪请求的效率。 6. **Bandwidth Management**:为了公平地分配网络资源,客户端会限制其上传和下载...

    bt 源代码

    10. **扩展协议**:原版BitTorrent协议经过多次扩展,如uTP(Micro Transport Protocol)用于优化网络资源,或者扩展如Fast Extension以加速文件交换。 11. **源代码结构**:熟悉常见的编程语言(如C++、Python或...

    开源项目-anacrolix-torrent.zip

    anacrolix-torrent客户端可能内置了对多种Tracker协议的支持,包括HTTP和UDP。 3. **DHT(分布式哈希表)**:为了增强网络的去中心化特性,该项目可能会实现DHT网络,即使没有Tracker服务器,客户端也能找到其他...

    bt原理讲解(华为内部资料)

    3. **传输层**:在此层,TCP/UDP报文的端口号提供了进一步的流量控制依据,通过扩展的ACL规则实现对特定服务或应用的流量管理。 #### 三、BT下载原理与协议介绍 资料深入探讨了BT下载的原理和协议,这是理解流量...

    局域网点对点的文件传输

    UDP(User Datagram Protocol)虽然更快但不保证数据顺序,通常用于实时性要求高的应用,如视频会议。 2. **多点连接**:P2P文件传输允许每个节点同时与多个其他节点连接,这种并发连接提高了传输效率。每个节点都...

    C#编写P2P视频聊天程序

    RTP(Real-time Transport Protocol)用于传输实时数据,而RTCP(Real-time Transport Control Protocol)则用于监控传输质量。C#实现P2P视频聊天时,需要理解并实现这两个协议,以确保音视频数据的高效传输。 ### ...

    python3.6.5参考手册 chm

    New Issue Tracker: Roundup New Documentation Format: reStructuredText Using Sphinx PEP 343: The ‘with’ statement Writing Context Managers The contextlib module PEP 366: Explicit Relative Imports...

Global site tag (gtag.js) - Google Analytics