Libtorrent Python

  

libtorrent is an ongoing project under active development. Itscurrent state supports and includes the following features:

  1. Top Python Libraries
  2. Libtorrent Python Tutorial
  3. Libtorrent Python 3.7
  4. Python Git Library
Libtorrent Python

BitTorrent v2

Starting with version 2.0, libtorrent supports BitTorrent V2 (as specified inBEP 52). BitTorrent V2 introduces a new format for .torrent files, which generallyhas a smaller info-dict than the original format. The .torrent files still containpiece hashes by default, but they can also be downloaded from peers.

Top Python Libraries

  1. Files are organized in a directory structure, instead of listing full paths.Torrents that have a lot of files in deep directory structures will use a lotless space to represent that structure in a v2 torrent.
  2. Piece hashes are organized in a merkle hash trees per file, and only theroots of the trees are included in the .torrent file. The actual hashes aredelivered by peers.

Introduction libtorrent is a feature complete C bittorrent implementation focusing on efficiency and scalability. It runs on embedded devices as well as desktops. It boasts a well documented library interface that is easy to use. A python module is a shared library. Specifying link=static when building the binding won't work, as it would try to produce a static library. Instead, control whether the libtorrent main library or boost is linked statically with libtorrent-link=static and boost-link=static respectively. By default both are built and linked as shared libraries. A python module is a shared library. Specifying link=static when building the binding won't work, as it would try to produce a static library. Instead, control whether the libtorrent main library or boost is linked statically with libtorrent-link=static and boost-link=static respectively. What's new in libtorrent 2.0.2: add v1 and v2 functions to torrentinfo; fix piecelayers to work for single-piece files; fix python binding regression in session constructor flags.

The hash tree allows validating payload received from a peer immediately, downto 16 kiB blocks. In the original bittorrent protocol a whole piece would haveto be downloaded before it could be validated against the hashes.

Example

The fact that each file has its own hash tree, and that its leaves are definedto be 16 kiB, means that files with identical content will always have the samemerkle root. This enables finding matches of the same file across differenttorrents.

The new format for torrent files is compatible with the original torrent fileformat, which enables hybridVisual studio for mac bot builder. torrents. Such torrents that can be used both asV1 and V2 and will have two swarms, one with V1 and V2 clients and one with onlyV2 clients.

Install libtorrent

Another major feature of the BitTorrent V2 protocol is that the SHA-1 hashfunction has been replaced by SHA-256.

extensions

Libtorrent msi

Libtorrent Python Tutorial

  • plugin interface for implementing custom bittorrent extensionswithout having to modify libtorrent
  • supports trackerless torrents (using the Mainline kademlia DHT protocol) withsome DHT extensions. BEP 5.
  • supports the bittorrent extension protocol. See extensions. BEP 10.
  • supports the uTorrent metadata transfer protocol BEP 9 (i.e. magnet links).
  • supports the uTorrent peer exchange protocol (PEX).
  • supports local peer discovery (multicast for peers on the same local network)
  • multi-tracker extension support (supports both strict BEP 12 and theuTorrent interpretation).
  • tracker scrapes
  • supports lt_trackers extension, to exchange trackers between peers
  • HTTP seeding, as specified in BEP 17 and BEP 19.
  • supports the UDP-tracker protocol. (BEP 15).
  • supports the no_peer_id=1 extension that will ease the load off trackers.
  • supports the compact=1 tracker parameter.
  • super seeding/initial seeding (BEP 16).
  • private torrents (BEP 27).
  • upload-only extension (BEP 21).
  • support for IPv6, including BEP 7 and BEP 24.
  • share-mode. This is a special mode torrents can be put in to optimize shareratio rather than downloading the torrent.
  • supports the Magnet URI extension - Select specific file indices fordownload. BEP 53.

disk management

Libtorrent Python
  • can use multiple disk I/O threads to not have the disk block network orclient interaction.
  • supports verifying the SHA-1 hash of pieces in multiple threads, to takeadvantage of multi core machines.
  • supports files > 2 gigabytes.
  • fast resume support, a way to avoid the costly piece check at thestart of a resumed torrent. Saves the storage state, piece_picker stateas well as all local peers in a fast-resume file.
  • queues torrents for file check, instead of checking all of them in parallel.resumes. This means it can resume a torrent downloaded by any client.
  • seed mode, where the files on disk are assumed to be complete, and eachpiece's hash is verified the first time it is requested.

Libtorrent Python 3.7

network

Python Git Library

  • a high quality uTP implementation (BEP 29). A transport protocol withdelay based congestion control. See separate article.
  • adjusts the length of the request queue depending on download rate.
  • serves multiple torrents on a single port and in a single thread
  • piece picking on block-level (as opposed to piece-level).This means it can download parts of the same piece from different peers.It will also prefer to download whole pieces from single peers if thedownload speed is high enough from that particular peer.
  • supports http proxies and basic proxy authentication
  • supports gzip tracker-responses
  • can limit the upload and download bandwidth usage and the maximum number ofunchoked peers
  • possibility to limit the number of connections.
  • delays have messages if there's no other outgoing traffic to the peer, anddoesn't send have messages to peers that already has the piece. This savesbandwidth.
  • selective downloading. The ability to select which parts of a torrent youwant to download.
  • ip filter to disallow ip addresses and ip ranges from connecting andbeing connected.
  • NAT-PMP, PCP and UPnP support (automatic port mapping on routers that supports it)
  • implements automatic upload slots, to optimize download rate without spreadingupload capacity too thin. The number of upload slots is adjusted based on thepeers' download capacity to work even for connections that are orders ofmagnitude faster than others.