Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a Gun Server as a relay only?

Is there a way to setup the GUN-server as a relay only? In other words, is there a way to ensure data is shared peer-to-peer only? The server only acts a signal (STUN like) server. In the few tests I've done I can't seem to see the data go P2P, and seems to only funnel through the gun-server.

I want to make sure the server has no client DB data on it. Obviously, connection info and possibly DB names would be there.

Thank you.

like image 914
Jbjet777 Avatar asked Aug 19 '18 02:08

Jbjet777


1 Answers

@Jbjet777 great question!

You can drop in lib/webrtc into your browser app as an extension to get direct P2P messaging if WebRTC works.

By default GUN still relays via the relay peer to ensure reliability, as WebRTC historically has been very unreliable (although we do hope this lib/webrtc adapter is more reliable than other frameworks).

That said, it is possible to configure the setup you want you can manually call gun.back('opt.peers')[relay_peer_url].wire.close() (make sure calling this is safe, add if-checks and stuff) after your WebRTC sessions have been established.

Please hit up the chatroom if you want further help on doing this.

Also note, why do you want the relay peer to not help store/sync data? Is it perhaps because you want to keep the data private? That is possible to do with our SEA security layer which can do end-to-end encryption. Just in case this makes things easier for you!

like image 145
marknadal Avatar answered Oct 18 '22 00:10

marknadal