Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTorrent are trackers needed for others to download from me ? #1526

Closed
C0nw0nk opened this issue Oct 11, 2018 · 10 comments
Closed

WebTorrent are trackers needed for others to download from me ? #1526

C0nw0nk opened this issue Oct 11, 2018 · 10 comments

Comments

@C0nw0nk
Copy link

@C0nw0nk C0nw0nk commented Oct 11, 2018

I am curious with my magnet URI in order for others to download from me do I need a tracker or does webrtc solve all of that and they can download from me with the magnet uri only or the .torrent file directly.

I want to seed to others of my site without trackers etc using only the .torrent fle or magnet uri. But I don't know if it works like that so any random user around the world can download from me ?

This post indicates nobody will be downloading from me.....?
https://stackoverflow.com/questions/34082637/how-to-use-webtorrent-io
WebTorrent doesn't support trackerless magnet URIs

Code

<script src="https://cdnjs.cloudflare.com/ajax/libs/webtorrent/0.102.4/webtorrent.min.js" type="text/javascript"></script>

<video controls="controls" controlslist="nodownload" oncontextmenu="return false;" preload="none" poster="/">
<source src="/" type="video/mp4" />
</video>

<script type="text/javascript">
var client = new WebTorrent();
var torrentId = 'magnet:?xt=urn:btih:blah-bleep-bloop'; //magnet uri only nothing else

client.add(torrentId, function (torrent) {

torrent.addWebSeed('https://www.domain.com/jpeg.jpg')

console.log('Torrent Ready')
var file = torrent.files.find(function (file) {
	return file.name.endsWith('.jpg')
})

var append_to_tag = document.getElementsByTagName('video')[0];
file.getBlobURL(function (err, url) {
if (err) throw console.log(err)
append_to_tag.poster = url
console.log('Client is downloading: ' + url)
})

})
</script>
@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 17, 2018

Hey @C0nw0nk,

Trackers are needed for initial peer discovery, specifically with WebTorrent in the browser, WebSocket trackers are used.

By default any torrent created by a WebTorrent client automatically has 8 trackers added, 3 being WebSocket trackers and 5 being udp, a list of these trackers can be viewed here!

Hope this helps!

@C0nw0nk

This comment has been minimized.

Copy link
Author

@C0nw0nk C0nw0nk commented Oct 18, 2018

Hello @SilentBot1

Thank you for the information, What about DHT?

I thought it had DHT and could work/function without any trackers ? As the github homepage even says DHT support....

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 18, 2018

@C0nw0nk,

DHT is supported, but only on platforms where possible, as a DHT node operates using UDP sockets, which aren't available for JavaScript to access in a browser, it is impossible to implement the Mainline DHT within a browser.

Also as the Mainline DHT store peers as their listening TCP addresses (as IPPORT encoded into a 6-byte string), even if browser WebTorrent clients were able to communicate with the Mainline DHT and receive the addresses, communication is impossible as like UDP sockets, TCP sockets aren't accessible to JavaScript in the browser either.

When WebTorrent is ran via NodeJS in the command line, the Mainline DHT is supported as both UDP and TCP sockets are accessible.

I hope this helps!

@C0nw0nk

This comment has been minimized.

Copy link
Author

@C0nw0nk C0nw0nk commented Oct 20, 2018

Is there any plans or development for a DHT websocket version ? cutting out all those issues. A bit like how sessions work i guess.

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 21, 2018

@C0nw0nk,

There have been discussions about it, one of which can be seen in this thread, but with how WebRTC connections are established and how a DHT works, it is near if not impossible to implement in the browser.

Sorry for the bad news, but I hope this helps none the less.

@C0nw0nk

This comment has been minimized.

Copy link
Author

@C0nw0nk C0nw0nk commented Oct 21, 2018

Be interesting to see a more universal solution to this problem.

Here is a github repo of trackers i found that i will use ontop of using the default ones.

https://github.com/ngosang/trackerslist

The more trackers we use the better right...?

@C0nw0nk

This comment has been minimized.

Copy link
Author

@C0nw0nk C0nw0nk commented Oct 21, 2018

You said UDP sockets, which aren't available for JavaScript to access in a browser,

So UDP trackers don't work either only websocket trackers will work ?

Because in the default tracker list there are UDP trackers strange enough. https://github.com/webtorrent/create-torrent/blob/6e6fc18aac7d212a5a8d9c766b12a525618e9ceb/index.js#L16

Also looking at the tracker types to add can i add http and https trackers as well as websocket / udp trackers ? https://github.com/ngosang/trackerslist/blob/master/trackers_all_https.txt

@SilentBot1

This comment has been minimized.

Copy link
Member

@SilentBot1 SilentBot1 commented Oct 21, 2018

Hey @C0nw0nk,

I haven't tested performance differences in adding more trackers but a wide range of trackers adds more redundancy to the torrent, though you need to be sure that the trackers support WebTorrent if you're only planning on using it in the browser.

The reason a range of tracker types are added is because the package that I linked, create-torrent, can be used in the command line to create torrents that work will all BitTorrent software, including all tracker types for the greatest level of support.

WebTorrent uses an extension of the HTTP/HTTPS Tracker Protocol to transfer the WebRTC offer and answers, meaning that standard trackers, even if they use http or WebSockets, do not work. The only tracker server that I know of that supports WebTorrent can be found here, and all the public bittorrent-tracker trackers are already included by default in the list I provided earlier.

Hope this helps!

@C0nw0nk

This comment has been minimized.

Copy link
Author

@C0nw0nk C0nw0nk commented Oct 21, 2018

So why won't webtorrent add support for the other tracker types why do they have to be running a webtorrent tracker for webtorrent to talk to it... Surely to add support for what already exists in the torrent tracking world and is mostly used can't be that hard and the benefits of doing so would be huge.

Especially when these trackers use http and https not udp or websockets. javascript can talk to it if the tracker communicates over http or https i am sure ajax or something of this nature can read the responses and talk to it.

http and https trackers should be added.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Oct 22, 2018

The trackers need to support webtorrent because the peers are webrtc offers/answers. There's no way to proxy or use direct udp/tcp/http(s) trackers.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.