All Projects → FredStober → tinyBT

FredStober / tinyBT

Licence: MIT license
Implementation of the Bittorrent and Mainline DHT protocol for Distributed Computing applications

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tinyBT

Snail
基于Java、JavaFX开发的下载工具,支持下载协议:BT(BitTorrent、磁力链接、种子文件)、HLS(M3U8)、FTP、HTTP。人家才不要你的⭐⭐呢,哼
Stars: ✭ 102 (+240%)
Mutual labels:  tracker, bittorrent, dht
Torrent Discovery
Discover BitTorrent and WebTorrent peers
Stars: ✭ 177 (+490%)
Mutual labels:  tracker, bittorrent, dht
dhtrobot
A kademila DHT implement in go
Stars: ✭ 40 (+33.33%)
Mutual labels:  bittorrent, dht
Bt Btt
磁力網站U3C3介紹以及域名更新
Stars: ✭ 261 (+770%)
Mutual labels:  tracker, bittorrent
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (+1360%)
Mutual labels:  tracker, bittorrent
uWebTorrentTracker
🔆 Simple, robust, WebTorrent tracker server implementation
Stars: ✭ 58 (+93.33%)
Mutual labels:  tracker, bittorrent
privtracker
Private BitTorrent tracker generator
Stars: ✭ 84 (+180%)
Mutual labels:  tracker, bittorrent
Torrent
Full-featured BitTorrent client package and utilities
Stars: ✭ 4,138 (+13693.33%)
Mutual labels:  tracker, bittorrent
Dht
dht is used by anacrolix/torrent, and is intended for use as a library in other projects both torrent related and otherwise
Stars: ✭ 184 (+513.33%)
Mutual labels:  bittorrent, dht
Bittorrent Tracker
🌊 Simple, robust, BitTorrent tracker (client & server) implementation
Stars: ✭ 1,184 (+3846.67%)
Mutual labels:  tracker, bittorrent
Unit3d Community Edition
🚀 A Next Generation Private Torrent Tracker (Community Edition)
Stars: ✭ 1,305 (+4250%)
Mutual labels:  tracker, bittorrent
pybtracker
UDP BitTorrent tracker written in Python 3.5 using co-routines and asyncio.
Stars: ✭ 46 (+53.33%)
Mutual labels:  tracker, bittorrent
Zx Bt
一个基于BitTorrent协议的DHT磁力嗅探器,并基于Elasticsearch存储/检索Torrent的Metadata信息
Stars: ✭ 244 (+713.33%)
Mutual labels:  bittorrent, dht
torrent
Bittorrent library implemented in pure Dart. [WIP, early development stage]
Stars: ✭ 26 (-13.33%)
Mutual labels:  tracker, dht
Magnetico
Autonomous (self-hosted) BitTorrent DHT search engine suite.
Stars: ✭ 2,626 (+8653.33%)
Mutual labels:  bittorrent, dht
Nyaa
Bittorrent software for cats
Stars: ✭ 2,899 (+9563.33%)
Mutual labels:  tracker, bittorrent
Antcolony
Nodejs实现的一个磁力链接爬虫 http://findit.keenwon.com (原域名http://findit.so )
Stars: ✭ 1,151 (+3736.67%)
Mutual labels:  bittorrent, dht
Bt
BitTorrent library and client with DHT, magnet links, encryption and more
Stars: ✭ 2,011 (+6603.33%)
Mutual labels:  bittorrent, dht
Trackerslistcollection
🎈 Updated daily! A list of popular BitTorrent Trackers! / 每天更新!全网热门 BT Tracker 列表!
Stars: ✭ 9,761 (+32436.67%)
Mutual labels:  tracker, bittorrent
Wt Tracker
High-performance WebTorrent tracker
Stars: ✭ 144 (+380%)
Mutual labels:  tracker, bittorrent

Build Status Coverage

tiny Bittorrent client

The goal is to supply an easy to use and simple to understand implementation of the BitTorrent specifications in python with no external dependencies except for the python standard library.

The implementation is spread over several files, each implementing a single component.

  • krpc.py - implements the basic UDP Kademila-RPC protocol layer
  • dht.py - contains the code for accessing the Mainline DHT using KRPC
  • tracker.py - implements the UDP and HTTP tracker protocol for peer discovery

KRPC Implementation

The KRPCPeer only exposes three methods:

  • init((host, port), query_handler) That takes the (host, port) tuple where it should listen and the second argument is the function that processes incoming messages.
  • shutdown() Shutdown of all threads and connections of the KRPC peer.
  • send_krpc_query((host, port), method, **kwargs) This method sends a query to a remote host specified by a (host, pool) tuple. The name and arguments to call on the remote host is given as well. An async result holder is returned, that allows to wait for a reply.

DHT Implementation

The DHT class offers the 4 DHT methods described in BEP #5 - each takes the remote host in the form of a (host, port) tuple as the first argument. The other arguments are the same as described in the specification. They all return an async result holder with the unprocessed data from the remote host:

  • ping(target_connection, sender_id)
  • find_node(target_connection, sender_id, search_id)
  • get_peers(target_connection, sender_id, info_hash)
  • announce_peer(target_connection, sender_id, info_hash, port, token, implied_port = None)

In addition, some additional helper functions are made available - these functions take care of updating the routing table and are blocking calls with a user specified timeout:

  • dht_ping(connection, timeout = 5) Returns the complete result dictionary of the call.
  • dht_find_node(search_id, timeout = 5, retries = 2) Searches iteratively for nodes with the given id and yields the connection tuple if found.
  • dht_get_peers(info_hash, timeout = 5, retries = 2) Searches iteratively for nodes with the given info_hash and yields the connection tuple if found.
  • dht_announce_peer(info_hash, implied_port = 1) Registers the availabilty of the info_hash on this node to all peers that supplied a token while searching for it.

The final three functions are used to start and shutdown the local DHT Peer and allow access to the discovered external connection infos:

  • init(listen_connection, bootstrap_connection = ('router.bittorrent.com', 6881), user_setup = {}, user_router = None) The constructor needs to know what address and port to listen on and which node to use as a bootstrap node. The run interval and some other parameters of the maintainance threads can be configured as well via the user_setup parameter. The default values are: {'discover_t': 180, 'check_t': 30, 'check_N': 10}. It is possible to provide a user implemntation for the DHT node router with the user_router parameter
  • shutdown() Start shutdown of the local DHT peer and all associated maintainance threads.
  • get_external_connection() Return the discovered external connection infos

Tracker Implementation

The tracker implementation provides functions to get the list of peers for a certain info_hash from a HTTP or UDP tracker. Each function returns a list of connection tuples with possible peers for the given info hash. The three non-optional parameters are the tracker url, info_hash and peer_id. Optionally it is possible to provide the peer ip and peer port, the amount already uploaded and downloaded as well as the amount left to download and the occasion / event of the request. This event can be either 'started', 'stopped', 'completed' or 'empty' (for regular queries).

  • http_get_peers(tracker_url, info_hash, peer_id, ip = '0.0.0.0', port = 0, uploaded = 0, downloaded = 0, left = 0, event = 'started')
  • udp_get_peers(tracker_url, info_hash, peer_id, ip = '0.0.0.0', port = 0, uploaded = 0, downloaded = 0, left = 0, event = 'started', num_want = -1, key = 0) With num_want it is possible to tell the tracker how many peers should be sent. The parameter key should be a unique key that is randomized by the client.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].