6

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.

Jbjet777
  • 61
  • 3

1 Answers1

7

@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!

marknadal
  • 7,534
  • 4
  • 25
  • 22
  • Thanks for the answer. Yes I'm loving the SEA security layer. I see the webrtc.js file in the lib folder of the GIT repository, besides adding that, I'm not really seeing any documentation on enabling the WebRTC options? – Jbjet777 Aug 26 '18 at 16:38
  • @Jbjet777 adding the file to your browser code automatically enables WebRTC. Unfortunately, documentation hasn't been written yet as it was only released last week... hopefully that'll happen soon! The code is quite short ( ~100 lines ish) so reading it should be easy / if you could contribute docs that would be a life saver! – marknadal Aug 26 '18 at 20:52
  • I did start to peek at the code. I'm still getting used to some of the coding concepts used in this project, so for now, its a bit beyond me to doc it. I'm gonna get some other parts of my project smoothed out and swing back to this in a bit. – Jbjet777 Aug 28 '18 at 06:57
  • No worries, sorry for the lack of documentation - although, understanding WebRTC ICE candidate flow is very confusing. You can always jump on https://gitter.im/amark/gun super friendly community there. :) – marknadal Sep 05 '18 at 17:29