Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAuthenticate seeders in browser #493
Comments
This comment has been minimized.
This comment has been minimized.
|
I think this is for you to figure out yourself and outside the scope of this project, but take a look at the "server" example in feross/bittorrent-tracker, specifically, the var Server = require('bittorrent-tracker').Server
var server = new Server({
udp: true, // enable udp server? [default=true]
http: true, // enable http server? [default=true]
ws: true, // enable websocket server? [default=true]
filter: function (infoHash, params, cb) {
// Blacklist/whitelist function for allowing/disallowing torrents. If this option is
// omitted, all torrents are allowed. It is possible to interface with a database or
// external system before deciding to allow/deny, because this function is async.
// It is possible to block by peer id (whitelisting torrent clients) or by secret
// key (private trackers). Full access to the original HTTP/UDP request parameters
// are available n `params`.
// This example only allows one torrent.
var allowed = (infoHash === 'aaa67059ed6bd08362da625b3ae77f6f4a075aaa')
cb(allowed)
// In addition to returning a boolean (`true` for allowed, `false` for disallowed),
// you can return an `Error` object to disallow and provide a custom reason.
})
}) |
This comment has been minimized.
This comment has been minimized.
|
Thank you, elad, for your answer. Actually, I need that all users can seed files, but only some could start a swarm. I apologize if opening this issue is an inconvenience. |
This comment has been minimized.
This comment has been minimized.
|
@gustavomrfz Take a look at @elad's example. He's correct. You'll want to look at the var client = new WebTorrent()
client.add(torrentId, { announce: 'your_tracker' }, cb) |
This comment has been minimized.
This comment has been minimized.
|
You should take a look at what parameters are available in Also, you mentioned: "The app is using a browserified webtorrent-hybrid". You don't need to use |
This comment has been minimized.
This comment has been minimized.
|
I were looking params more carefully and I belive peerid parameter will be enough, with the help of a pair of queries to a database. To be honest, I am using bittorrent-tracker with cmd.js launcher with any modifications so far, but it's time to make my own script. I took note of your advice about using webtorrent. I realize there is no real reason to use webtorrent-hybrid in this case. |
This comment has been minimized.
This comment has been minimized.
|
Awesome, glad we could help! |
I would like to authenticate some users in a way they could seed whatever they want and some unauthenticated users who only can seed a file if any authenticated user did it before. For that, I will use a database that stores first-time-seeded magnets-uri and so unauthenticated users could upload any magnet that was previously shared al least once. I need to make some authentication system in tracker or in nodejs server to avoid that any person could upload copyrighted stuff. The app is using a browserified webtorrent-hybrid and bittorrent-tracker.
Any ideas?