chr15m / bugout

Back end web app services over WebRTC.
https://chr15m.github.io/bugout
MIT License
607 stars 59 forks source link

Ability to prevent another server with the same identifier from connecting to existing server? #13

Closed draeder closed 4 years ago

draeder commented 4 years ago

I've been playing around with your messageboard demo. I'm a novice/intermediate javascript tinkerer, so I might be missing something obvious. Reading through your documentation you state:

All Bugout instances connecting to the same string identifier will join a p2p room where no particular peer is considered to be the server.

I would like to detect if the connection is coming from another server and manage that connection by not allowing it. This way servers would only ever have a unique identifier. The problem is, I can see how to determine there is a new connection, but I cannot see how determine if that new connection shares the same Identifier as the initial one. If that's even possible, the next part I would want is how to disallow that connection.

The use case here is that I would like to Server A and Server B always be unique. If Server A needs to connect to Server B, it should only allow that from client.

Is this possible under the existing API?

chr15m commented 4 years ago

@draeder first thing to note is every node gets a globally unique ID by default. So no two nodes will share the same ID. If you want client nodes to treat a particular node as the server then the easiest way to accomplish that is to have the clients connect to the server's public address.

Let me know if this answers your question or if you need more info.

draeder commented 4 years ago

Thank you for the clarification.