Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It's (beyond) time to sunset the *-star protocols 🌅 #385

Closed
8 tasks
daviddias opened this issue Jul 21, 2019 · 6 comments
Closed
8 tasks

It's (beyond) time to sunset the *-star protocols 🌅 #385

daviddias opened this issue Jul 21, 2019 · 6 comments

Comments

@daviddias
Copy link
Member

daviddias commented Jul 21, 2019

Long story short for context:

Proposal: Let's sunset the *-star protocols 🌅

To clarify:

Direct benefits:

  • By cutting of the *-star transports, we would be saving the time from reinventing the wheel and also reduce the confusion from the users.
  • Any IPFS node could then be the rendezvous or the relaying address (meaning that we can use the go-libp2p to handle with even more clients). More
    • We avoid spending time creating custom instrumentation and use instead the instrumentation that IPFS & libp2p have.
    • Any security, perf improvement or memory leak fix will be directly on libp2p and/or IPFS rather than external "temporary" code.
  • People would not have to rely on a centralized of custom built infrastructure, instead, they could use it with any IPFS node.

Candidate Roadmap:

  • Milestone 1: Sunset any variation of the websocket-star (star, stardust, multi, and so on)
    • Verify that https://github.com/libp2p/js-libp2p-rendezvous is complete and well tested
    • Remove any trace of *-star transport from js-libp2p (examples, docs)
    • Remove any trace of *-star transport from js-ipfs (examples, docs, base config)
    • Upgrade PeerPad to use rendezvous & circuit-relay to find other peers (dropping webrtc-star)
    • Make it default with js-ipfs
  • Milestone 2: Sunset webrtc-star (easier, if the above is done first)
    • Create webrtc-circuit-relay-exchange (for lack of better name for now) that uses the Circuit Relay to exchange the SDP offer.
    • Test it with PeerPad
    • Make it default on js-ipfs
@backkem
Copy link

backkem commented Jul 22, 2019

I suggest to make this effort implementation independent. That should make it fairly straightforward to adapt libp2p/go-libp2p-webrtc-direct and get webrtc working between the browser and Go clients.

cc libp2p/go-libp2p-webrtc-direct#14

@alanshaw
Copy link
Member

I'm 👍 on this. Maybe I'm missing something but I think there's a piece missing...

Right now, websocket-star is the most reliable way for JS IPFS nodes in the browser to discover and communicate with each other. It kinda works because we don't have the whole of the IPFS network using it, and it cannot be discovered by the rest of the IPFS network (or used since there's no Go impl). This makes it great for demos, development and testing.

In the proposal , we'd be taking this resource away from the community without providing a replacement. Can we setup some circuit relays that JS IPFS nodes can use for demos, development and testing but the rest of the network doesn't discover and use on a day to day basis? I'm not familiar with how you'd go about doing that, it's possible right? I imagine it's something application developers would really need also.

@daviddias
Copy link
Member Author

daviddias commented Jul 22, 2019

In the proposal , we'd be taking this resource away from the community without providing a replacement.

Not the case, let me clarify. The proposal contemplates:

  • Deploying one or more IPFS nodes that are relays specifically for this purpose and not for the entire network (equivalent to the rendezvous/signalling point for any -star transport)
  • Have js-ipfs nodes by default advertising those relay addresses
  • Set up a node with the rendezvous protocol on and register every new js-ipfs node in that rendezvous

This is a direct replacement that will be transparent. In fact, users might see things getting faster and more reliable as they will be able to use go-libp2p (more performant) as a circuit relay. This way everything is a libp2p node, no custom pieces that reimpl the same thing.

@jacobheun
Copy link
Contributor

jacobheun commented Jul 23, 2019

Milestone 1: Sunset any variation of the websocket-star

https://github.com/libp2p/js-libp2p-rendezvous should be close as the initial spec didn't deviate much but needs to be updated and heavy testing still needs to be done. It doesn't have any federation at this point, but we don't need that to replace the star servers. Federation will need to be added in the future to better support decentralization of the node.

I have been thinking through the flow for doing connection upgrades for WebRTC signaling over the circuit. Part of that potentially uses the DHT (local or delegate) as a means of finding services instead of Rendezvous. This would allow us to spend more of our effort improving that, instead of fragmenting our focus. Here are my notes on how that flow could/would look:

Connection flow

  • Node A discovers Relay r
    • How does Node A discovery Relay r?
      • This could be hard coded as a "Bootstrap" node
      • A DHT query could be made to find relays, assuming the Relay has registered as a provider of the relay protocol
      • The relay could use a Rendezvous server to find relays
      • ...?
  • Node A connects to Relay r
  • Once connected, Node A adds Relay r as a Priority Peer, so that it can maintain this connection for listening.
  • Node A adds the Relay r, /p2p-circuit relay address to its list of advertised addresses.
  • Node A performs an Identify Push update to all its connected peers to inform them of the address change.
  • Node A advertises its purpose/support/content (such as telling the network it's a Peer Pad node)
    • How does this advertisement happen?
      • It could register with a Rendezvous server using the Rendezvous protocol.
      • It could register as a Peer Pad "provider" via the DHT.
      • ...?
  • Node B joins the network and looks for other Peer Pad nodes.
    • How does it find them?
      • The same as process as Node A uses to discover Relay r as detailed above
  • Node B discovers Node A and its advertised /p2p-circuit address.
  • Node B connects to Relay r, to connect to Node A
  • Node B and Node A are connected via Relay r
  • Both nodes start a Connection Upgrade (such as WebRTC)
    • How is this handled?
      • We need a way to determine available upgrade transports
      • Once we agree on the transport we need to begin the WebRTC SDP exchange, or another upgrade process for the decided transport
  • The nodes establish a direct connection to one another over the WebRTC (or other) transport
    • What happens if this fails? Should the nodes continue to leverage the Relay to exchange data? If so, it may be expensive for the relay node. If not, how can the nodes talk to one another?
      • If there was a distinction between nodes behaving as only "signaling relays", and nodes behaving as "data exchange relays", nodes could potentially be customized to support high/low connections or high/low bandwidth.
  • Node B, as the dialer, requests a disconnect of the relayed connection
  • Node A, ACKs the disconnect and disconnects the relayed connection
    • Node A must maintain its direct connection to Relay r, as it is using it as a listen address
  • Node A and B are now free to exchange data over their direct connection

achingbrain pushed a commit to ipfs/js-ipfs that referenced this issue Jun 22, 2020
On `js-ipfs@0.41`, we removed the `websocket-star` module from the libp2p default configuration for browser nodes in `js-ipfs`. We removed it because this module was not refactored during #1670, since the libp2p goal is to [sunset the star protocols](libp2p/js-libp2p#385) and we preferred to use the time refactoring `websocket-star` into improving the browser support.

In the refactor, the `webrtc-star` module was refactored so that browser users could discover other peers in the network. In addition, `circuit-relay` may be used for establishing connections between browser nodes using `websockets`.

However, this migration has not been smooth for `js-ipfs` users. Users previously using `websocket-star` swarm addresses, did not have enough visibility of this change, since the removal of `websocket-star` was transparent for them and on the default `js-ipfs` release and not technically a programmable breaking change. 

With the above in mind, once `js-ipfs` users updated they started getting errors from `js-libp2p` in scenarios where they were providing only `websocket-star` swarm addresses. When `js-libp2p` receives listening multiaddrs, it throws an error if it cannot use any to listen on the configured transports, which was the case here (For instance #2779).

In `js-libp2p`, we added an option to tolerate these errors [libp2p/js-libp2p#643](libp2p/js-libp2p#643), which was also mentioned for some other cases earlier.

After syncing about this issue, we decided to temporarily throw an error when `js-ipfs` receives `websocket-star` multiaddrs. This aims to help users who still need to migrate to identify the problem faster.
@mxinden
Copy link
Member

mxinden commented May 10, 2023

@p-shahi with /webrtc and /webrtc-direct, can we close here?

@p-shahi
Copy link
Member

p-shahi commented May 10, 2023

Yes closing this, we're deprecating them here: #1488

@p-shahi p-shahi closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants