Skip to content

Webtorrent support #138

Closed
Closed

Description

@faddat

Issuehunt badges

Does this client by any chance support webtorrent?

If no, anyone know of a go torrent solution that does?

thanks!


IssueHunt Summary

anacrolix anacrolix has been rewarded.

Backers (Total: $250.00)

  • steelbrain steelbrain ($50.00)
  • $200.00 have been anonymously funded.

Submitted pull Requests


Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

Activity

  1. anacrolix commented on Dec 12, 2016

    @anacrolix
    Owner

    Do you refer to https://github.com/feross/webtorrent ? Can you link to a spec on bittorrent clients interacting with webrtc clients?

  2. faddat commented on Dec 15, 2016

    @faddat
    Author

    Not offhand, but I'm happy to google for it....

    To leverage existing WebRTC implementations a dedicated instance of a Chromium browser is used. This 'bridge' mediates communication between Vuze and WebTorrent peers.
    For the original implementation see https://webtorrent.io/

    ....ouch.

    Maybe I can find better in the node.js?

  3. anacrolix commented on Dec 19, 2016

    @anacrolix
    Owner

    That's as much as I found. If you found specifics in the node.js code, that may expedite adding support for this.

  4. faddat commented on Jan 2, 2017

    @faddat
    Author
  5. feross commented on Jan 21, 2017

    @feross

    Hey! We'd love to help make WebTorrent support happen here. We're working on a spec. I'll share here when it's complete. At the moment you can check out the following files, to see what's going on:

    To sum up what it would take to support this:

    • webrtc library or bindings in Go
    • websocket library

    When a ws:// or wss:// tracker is detected, create a websocket connection to that server. There are a few extra announce message types to facilitate establishing webrtc connections "offer" and "answer", but everything else is essentially the same.

    Once connected to a peer over WebRTC, you can treat the remote peer exactly the same -- the wire protocol is exactly the same.

  6. mattlepacek commented on Apr 17, 2017

    @mattlepacek

    Webtorrent support here would be amazing. The current node.js implementations are limited by chromes implementation of webrtc causing cpu time to multiply with each torrent being seeded. I'm interested in sponsoring Webtorrent support

  7. anacrolix commented on Apr 21, 2017

    @anacrolix
    Owner

    I'll revisit this when there's a spec.

  8. KeizerDev commented on Jun 1, 2017

    @KeizerDev
  9. anacrolix commented on Jun 2, 2017

    @anacrolix
    Owner

    No progress. There's no spec, and WebRTC is abysmal to work with.

  10. Sean-Der commented on Jul 7, 2018

    @Sean-Der
    Contributor

    Hey @anacrolix !

    I have been working on Go native WebRTC https://github.com/pions/webrtc and would love to get it to the point that you could use it!

    It currently has full support for Audio/Video (send and recv) and I am maybe two weeks out from finishing DataChannels. We have ~5 developers involved, so things are moving pretty quick! If you are interested would love to chat/figure out what is most important to you. All the devs are on the Gophers slack in the #pion channel

  11. anacrolix commented on Jul 7, 2018

    @anacrolix
    Owner

    That sounds great @Sean-Der . I'm guessing WebRTC is not so simple as a stream of bytes, when data-channels are ready we can look at integrating those. Specifically dial/accept interfaces are required, and a way to send/receive bytes. A spec on how the peer protocol operates over WebRTC is still required.

    Unrelated, there was a comment earlier about websocket trackers, I've yet to see any in the wild. Some examples of those will be helpful. Implementing those should be very easy.

  12. jimmywarting commented on Jul 23, 2018

    @jimmywarting
  13. anacrolix commented on Jul 24, 2018

    @anacrolix
  14. Sean-Der commented on Jul 24, 2018

    @Sean-Der
  15. 40 remaining items

  16. anacrolix commented on Feb 25, 2020

    @anacrolix
    Owner

    The Dialer and Listener interfaces have been abstracted out in #380, which is the first step toward implementing this. I've created https://github.com/anacrolix/torrent/milestone/2 to track any issues and PRs that progress this issue.

  17. Sean-Der commented on Mar 18, 2020

    @Sean-Der
    Contributor

    Anything I can do to help @anacrolix ? Happy to get involved with any of the WebRTC stuff.

  18. anacrolix commented on Mar 19, 2020

    @anacrolix
    Owner

    @Sean-Der I've created issues the next 2 items we need. I think it may be possible to do them concurrently, so long as the addr string is agreed upon by the tracker and Dialer implementations. See those issues for more information. I've not had time myself to progress further yet due to work and other constraints.

  19. anacrolix commented on Apr 5, 2020

    @anacrolix
    Owner

    I did some more investigating. This looks exceptionally difficult to integrate into the existing code. The tracker and connection management are tightly coupled. It's also probably not appropriate just to maintain state at the Torrent level for trackers, it might be necessary at the Client level in order to scale to many Torrents with the same tracker URLs specified. The potential for disconnection from the trackers is a real kicker, I think there will be need to be many events flowing around the system.

  20. backkem commented on Apr 5, 2020

    @backkem

    I think disconnecting form the tracker isn't the end of the world. Once established, the WebRTC connections don't need the tracker's Websocket connection to stay alive.
    However, losing the connection before signaling is complete does mean you won't be able to complete the setup of a WebRTC connection.

    Managing the tracker Websocket connections globally is probably a good idea since they will have more overhead than regular UDP ones.

  21. backkem commented on Apr 5, 2020

    @backkem

    The WebRTC connection setup is likely even more tricky. Normally WebRTC will allocate random ports for both sides of the connection. In addition, there are two steps: signaling (tracker) and the actual connections (torrent). This would require a bunch of back-and-fort between the tracker and connection logic and it's quite inefficient for this use-case.

    However, unlike in the browser we have more control over the network stack. You could potentially address these downsides as follows:

    • Create an offer with one IP and a random port (Potentially without actually allocating it but that creates a risk that it will be taken later..) and a random certificate.
    • Announce it to the tracker.
    • Create answers for incoming offers by always using one IP and the same port but different certificates.
    • Send it to the tracker.
    • Listen on that one port for incoming connections.
    • When a connection comes in, identify it by looking up the IP & certificate in the offers you received. (This may require some DTLS trickery..)
    • Establish the connection.

    This would mean:

    • Decent separation between tracker & torrent connection logic.
    • Reduced need to pro-actively open a bunch of listening ports.

    The pion/webrtc library should be flexible enough to make this happen.

  22. anacrolix commented on Apr 7, 2020

    @anacrolix
    Owner

    Thanks for the assistance again @backkem. I have a in-progress branch at https://github.com/anacrolix/torrent/tree/webtorrent that's able to download. Within the torrent repo, you can test it with GOPPROF=http go run -race -v ./cmd/torrent -dht=false 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=wss://tracker.btorrent.xyz&tr=wss://tracker.fastcast.nz&tr=wss://tracker.openwebtorrent.com'. It's very rough for now, but I'll continue to mold it to the torrent architecture, and take suggestions and improvements from people more familiar with WebRTC and webtorrent.

  23. anacrolix commented on Apr 13, 2020

    @anacrolix
    Owner

    That command is now $ GOPPROF=http go run -v ./cmd/torrent download -dht=false -tcpPeers=false -utpPeers=false 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel&tr=wss://tracker.btorrent.xyz&tr=wss://tracker.fastcast.nz&tr=wss://tracker.openwebtorrent.com'.

  24. self-assigned this
    on Apr 13, 2020
  25. issuehunt-oss commented on Apr 15, 2020

    @issuehunt-oss

    @anacrolix has rewarded $225.00 to @anacrolix. See it on IssueHunt

    • 💰 Total deposit: $250.00
    • 🎉 Repository reward(0%): $0.00
    • 🔧 Service fee(10%): $25.00
  26. anacrolix commented on Apr 15, 2020

    @anacrolix
    Owner

    I'm closing this as done. There are further improvements to be made, but now that Webtorrent is supported on master, those will come over time.

  27. jpillora commented on Apr 16, 2020

    @jpillora
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    ⌂ 换网址