Closed faddat closed 4 years ago
@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.
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.
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.
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:
This would mean:
The pion/webrtc library should be flexible enough to make this happen.
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.
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'
.
@anacrolix has rewarded $225.00 to @anacrolix. See it on IssueHunt
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.
Nice work Matt!
On Thu, 16 Apr 2020 at 9:35 am Matt Joiner notifications@github.com wrote:
Closed #138 https://github.com/anacrolix/torrent/issues/138.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/anacrolix/torrent/issues/138#event-3237633578, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2X4234VIIWQYJNC6W6MTRMZAE7ANCNFSM4CZIEDIQ .
Does this client by any chance support webtorrent?
If no, anyone know of a go torrent solution that does?
thanks!
IssueHunt Summary
#### [ anacrolix](https://issuehunt.io/u/anacrolix) has been rewarded. ### Backers (Total: $250.00) - [ steelbrain](https://issuehunt.io/u/steelbrain) ($50.00) - $200.00 have been anonymously funded. ### Submitted pull Requests - [#393 Webtorrent support](https://issuehunt.io/r/anacrolix/torrent/pull/393) --- ### Tips - Checkout the [Issuehunt explorer](https://issuehunt.io/r/anacrolix/torrent/) to discover more funded issues. - Need some help from other developers? [Add your repositories](https://issuehunt.io/r/new) on IssueHunt to raise funds. --- IssueHunt has been backed by the following sponsors. [Become a sponsor](https://issuehunt.io/membership/members)