amark / gun

An open source cybersecurity protocol for syncing decentralized graph data.
https://gun.eco/docs
Other
17.93k stars 1.16k forks source link

Use trystero for webrtc (with bittorrent dht signalling) #1361

Closed sloev closed 5 months ago

sloev commented 5 months ago

i just fell over https://github.com/dmotz/trystero which seems like a pretty decent try at making webrtc + distributed signalling happen.

trystero abstracts away the maintenance of webrtc and bootstraps itself using bittorrent. i would like to see if i can make trystero do what lib/webrtc currently does, shouldnt be hard i guess.

have anyone tried using trystero with gundb?

sloev commented 5 months ago

possibly solved using websocket proxy internally using trystero like here: https://github.com/Dletta/dht-proxy/blob/main/index.html#L58

sloev commented 5 months ago

how to use hyperswarm with gundb for peer adresses: https://github.com/futureproofso/tv/blob/main/buoy/index.js#L57

also mentioned here: https://github.com/Dletta/dht-proxy/issues/3

crunchysteve commented 5 months ago

Great, just what we need, another peer-to-peer environment that is without a standard that any app can use. We need a IETF standard, peer-to-peer protocol, with a user interface as simple as email or the web, etc, that's compatible with any app written for it. BitTorrent and IPFS come close to being infrastructure, but the addressing of the former is random AF and the latter's addressing stinks of nerd and there's no way your mum would chat to you there.

Seems to me everybody's creating apps, nobody's creating infrastructure. Oh, then there's SSB, which is infrastructure, but it doesn't have profile portability across devices.

Don't get me wrong, I think it's great that everybody wants to decentralise the world, and I get that it's super hard to handle p2p addressing in a way that works behind a NAT, but the reason for P2P is decentralisation. A thousand different apps or a million pages on the browser, are just apps and will never be infrastructure.

On Wed, Jan 24, 2024 at 6:46 PM sloev @.***> wrote:

i just fell over https://github.com/dmotz/trystero which seems like a pretty decent try at making webrtc + distributed signalling happen.

trystero abstracts away the maintenance of webrtc and bootstraps itself using bittorrent. i would like to see if i can make trystero do what lib/webrtc currently does, shouldnt be hard i guess.

have anyone tried using trystero with gundb?

— Reply to this email directly, view it on GitHub https://github.com/amark/gun/issues/1361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALDXPCBQ523UG66WEL4XEQ3YQC33VAVCNFSM6AAAAABCII54ECVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4TONRUG42TQNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sloev commented 5 months ago

@crunchysteve

Great, just what we need, another peer-to-peer environment that is without

i dont think its helpful or necesarry to drop your sarcasm on my github issue like that. Addressing and peering in the browser is super hard and while i agree that the standards need to address and solve that issue for us all to be decentralized i think you completely disregard my question in this thread.

lets be on track: peering in a decentralized manor is hard with gundb, can we use hyperswarm, easypeers etc to make it easier for the moment?

sloev commented 5 months ago

by using a private webtorrent tracker with whitelisted info hash together with trystero and websocket proxy from https://github.com/Dletta/dht-proxy/blob/main/index.html#L58 i think its possible to create an ideal bootstrapping mechanism

sloev commented 5 months ago

I have succesfully used gundb with a client side websocket proxy to trystero doing webrrc signalling with a private webtorrent tracker using whitelisted infohashes here:

https://github.com/sloev/saysheep

Take a look in src/db/

It works super great and no data runs through the tracker, only signalling

PhilienTaylor commented 5 months ago

Hey, @sloev , I really like your contribution. Here's why. First, I don't think there'll ever be standards and protocols for peers speaking to peers. Peers speaking to peers recognize the kind of nation they speak upon, which is a type of out-of-band communication. I'm referring to software ideologies, networking frameworks, or content circulations, and then some. Just look at identical twins: each set have their own communication structure and don't need somebody telling them the foundations or standards to create this peer-to-peer communication.

Second, I think your library and its use of Trystero creates a foundational structure other developers can use. On the GUN Wiki page for Awesome Gun, there's a variety of softwares that people have developed using GUN. It's not up to date. Many cool GUNdb softwares have shown up in the Gitter chat that aren't in that list. People are using GUN in a variety of ways that deserve to be collected so others can decide if they need to reinvent the wheel, or if your wheel is good enough. I like your creation, it shows a variety of features that not only has @amark asked for, but an extensibility that any coder can use.

Finally, I like your work and want you to add a Readme.md, as well as more commentary and code. I think that SaySheep would not just be used by default to connect to peers, it would also be extended and implemented so that other users could create more complex and nuanced peer-to-peer negotiations via the central WebTorrent tracker. I had to take some time to read the code to understand what it does, and I think I have a rudimentary idea. I think if you described the basic use case--'find other GUN peers with a WebTorrent tracker and without using a GUN relay'--you could help other users create true P2P applications via WebTorrent tracker swarming and without a GUN relay storing data for bootstrapping.

Thank you for your work, @sloev !! :D

sloev commented 5 months ago

@PhilienTaylor @amark here is a documented example of how to use webtorrent for signalling in gundb using trystero: https://github.com/sloev/gundb_torrent_signalling