25

Libtorrent Now Support WebTorrent Protocol

 3 years ago
source link: https://github.com/arvidn/libtorrent/pull/4123
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

This PR suggests an implementation of the WebTorrent protocol inside libtorrent. With this add-on, libtorrent can be used to run hybrid peers seamlessly.

WebTorrent peers use the same application protocol as classic peers but with WebRTC Data Channels as underlying transport instead of uTP or TCP, allowing to run peers in web browsers. Due to the necessary connection signaling, WebTorrent peers require a specific WebSocket tracker to connect.

Since documentation seems to be lacking, I implemented the WebTorrent signaling protocol the best I could guess by looking at existing code. You can find useful information and the reference Javascript implementation here: https://github.com/webtorrent/webtorrent

The implementation requires two external dependencies added as submodules:

  • libdatachannel , my lightweight WebRTC Data Channels implementation, which relies on my ad-hoc UDP Interactive Connectivity Establishment (ICE) library libjuice
  • boost.JSON , a header-only JSON library for the tracker protocol

This PR does not add new external dependencies to libtorrent (it only requires OpenSSL or GnuTLS depending on the compilation option).

To test, you need a torrent file with at least one WebSocket tracker, for instance wss://tracker.openwebtorrent.com .

You can find such a torrent file here: https://ageneau.org/upload/sintel.torrent

You can also run a web browser peer on this page: https://webtorrent.io/


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK