ssbc / ssb-server

The gossip and replication server for Secure Scuttlebutt - a distributed social network
1.69k stars 164 forks source link

Attachments #149

Closed No9 closed 9 years ago

No9 commented 9 years ago

@dominictarr I see you are thinking that large attachments should be torrents https://github.com/ssbc/scuttlebot/wiki/FAQ#attachments

Are you working on this? I am back in the torrent zone at the moment and this interests me so I am tempted to have a shot.

pfrazee commented 9 years ago

It's one of our "gee whiz, what if" ideas, so it's not on our roadmap atm. By all means, give it a go!

@dominictarr feel free to give your thoughts. I think the way to go at it would be to put the magnet URI in an ext link, eg { type: 'foo', torrent: { ext: $MAGNET_URI } }. Then we'd need to update the blobs plugin in sbot so that it doesn't try to fetch that blob (it should look at the ext value and discern if it's a content-hash or something else, eg a magnet link). After that, it's just a matter of having some code watch the incoming stream and operate the torrents, which you could do with a custom sbot plugin or with an external program.

Please post your implementation notes/plans as you go! I'd like to learn more about the torrent protocol.

No9 commented 9 years ago

Thanks for the steer @pfraze
I'll have a look at your recommendations and see how it plays out. I expect a tracker to be put into the public server as well but I will see where we it lands.

dominictarr commented 9 years ago

@No9 this would be awesome!

@feross is currently working on the finishing touches to webtorrent (which benefits immensely from having hybrid torrents that can bridge between tcp and webrtc)

One other thing, it would be very good to include the size of the torrent in the link, then peers can download things preemptively, but not dedicate too much resources.

@pfraze @No9 it might be better to have a slightly different format there, I suspect that overloading ext will add complications later. It might be better to just have a torrent type? {type: 'iso', <rel>: {torrent: <magnet_link>}} or using an ext link would be ok if it was a link to the torrent file.

pfrazee commented 9 years ago

Yeah the downside to using .torrent is that it won't get indexed by sbot as a link.

dominictarr commented 9 years ago

@pfraze we could add that though! there are more subtleties here too, like a magnet link has the info hash (which is deterministic) but also links to trackers (which is easy to change) it would probably be very good to have pub servers be trackers, too.

pfrazee commented 9 years ago

@dominictarr that's true, I'm just thinking, will more people want to add blob protocols (ipfs, http)? and maybe it'd be better to overload ext than to split them all out.

I agree about pubs being trackers, that makes plenty sense.

dominictarr commented 9 years ago

I'd be okay with adding ipfs (deterministic and decentralized) but not http. torrents are quite different to how current attachments work, like, you can stream and seek into torrents. If it uses a different protocol, that needs to be marked in some way...

Also, the capabilities of mynosql it might not be necessary to have specific link indexes at all.

ahdinosaur commented 9 years ago

it would probably be very good to have pub servers be trackers, too.

oooh, yeah!

dominictarr commented 9 years ago

closing this, since we decided not to merge this feature for simplicity reasons