Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions proposals/browser-nodes-can-connect-to-any-node-out-of-the-box.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Browser nodes can connect to any node out of the box

Authors: @vasco-santos

Initial PR: https://github.com/protocol/web3-dev-team/pull/70

<!--
This template is for a proposal/brief/pitch for a significant project to be undertaken by a Web3 Dev project team.
The goal of project proposals is to help us decide which work to take on, which things are more valuable than other things.
-->
<!--
A proposal should contain enough detail for others to understand how this project contributes to our team’s mission of product-market fit
for our unified stack of protocols, what is included in scope of the project, where to get started if a project team were to take this on,
and any other information relevant for prioritizing this project against others.
It does not need to describe the work in much detail. Most technical design and planning would take place after a proposal is adopted.
Good project scope aims for ~3-5 engineers for 1-3 months (though feel free to suggest larger-scoped projects anyway).
Projects do not include regular day-to-day maintenance and improvement work, e.g. on testing, tooling, validation, code clarity, refactors for future capability, etc.
-->
<!--
For ease of discussion in PRs, consider breaking lines after every sentence or long phrase.
-->

## Purpose &amp; impact
#### Background &amp; intent
_Describe the desired state of the world after this project? Why does that matter?_
<!--
Outline the status quo, including any relevant context on the problem you’re seeing that this project should solve. Wherever possible, include pains or problems that you’ve seen users experience to help motivate why solving this problem works towards top-line objectives.
-->

One of the key environments for the web3 is the browser. Browser nodes have several connectivity challenges that result from their environment, with the most relevant being:
- unable to listen for incoming dials;
- no support for TCP;
- security policies require dials with WSS and DNS addresses.

Circuit relays have been used to work around these limitations. Browser nodes can establish a connection with them and bind to them to receive incoming dials. They can also be used to "translate" a connection from Websockets to TCP and consequently, enable browser nodes to dial GO nodes.

##### Problem Statement

One of the critical pieces in the puzzle is the lack of ability from browser nodes to connect with GO nodes out of the box (majority of the network). By default, GO nodes do not listen on Websockets, nor have DNS + SSL configured. In addition, GO nodes do not bind to relays out of the box. This creates a network fragmentations and results in problems creating pubsub overlay, getting IPNS records, among others.

Having browser nodes to connect with go nodes out of the box essentially means one of:
- go nodes listen on webrtc by default + we can use limited relays to also negotiate webrtc conns + we deploy nodes that can act as limited relay and have dns + wss addresses (which means not all DHT servers will be capable of doing so out of the box)
- go nodes listen on websockets address by default + we find a solution for out of the box certificates for announcing dns+wss multiaddr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the certificate problem seems like it could be a project in itself, go-ipfs certbot integration or something like that, the whole certificate problem is a diabolical one!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see ipfs/in-web-browsers#181 touches on some of the issues related to certs, but that doesn't even suggest a clear path forward. That presents us with a scoping challenge here, we have no clear technical solution and this may end up being experimentation to figure out something workable. Ideally we'd have a solid idea to at least try and can scope fail/success with that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An experimental project here would be to vet the feasibility of a service to issue subdomain certs/DNS mappings to https://<peerid>.libp2p.io or similar.

The other option is likely more viable (bind to a limited relay), but, we have to consider that if hole punching fails the nodes won't be able to speak.

Another option here is improving the active relay support story. If browser nodes are able to bind to a local node, or potentially later a relay-as-a-service, then execute dials through the relay as a fallback we can reduce the dependency on the SSL problem. This might look like:

  • Improve browser ability to discover local and remote relays to bind to
  • Ensure those relays can be/are configured to be active HOP relays (dial on a nodes behalf)
  • Improve the prevalence of these relays (more local deploys, ipfs desktop, embedded browser nodes, hosted/incentivized services, electron template app)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://<peerid>.libp2p.io sounds like a whole can of worms, similar to the gateway problems (hosting content we don't necessarily want to host) but for more than just content (i.e. someone could abuse the service to host whatever they like, https, on a domain we own. Maybe there's been some thought put into how to deal with these kinds of problems already?

2 other options for managing certificates:

  1. Build a certbot plugin to manage certificates for a go-ipfs node, probably with some go-ipfs interaction to setup the challenge process (down side: this is very opt-in, even if we make it super simple for them)
  2. go-ipfs already has some user-interactive startup operations that it performs (fs migrations being the main one I think), so another option here is to build in the full letsencrypt certificate management process to node setup - as an optional, but encouraged step. It'd not be a simple project, but there's a full featured go library for dealing with ACME so we could run the entire process, including renewals, with some initial setup from the user.

The challenge process introduces awkwardness in both options but there could be a simple-path for easy setups (no NAT, no complex firewalls, etc.) and documentation for the more complex-path setups.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That presents us with a scoping challenge here, we have no clear technical solution

I think we should attack this in two stages (updated ipfs/in-web-browsers#181 to reflect that):

  1. Add ACME support as opt-in "bring your own domain" feature to go-ipfs
    • safe to do, reduces complexity of /wss/ deployments: no need for third party software like certbot or nginx.
  2. Each peer gets a free domain out-of-the-box
    • this is a can of worms which will take time, or we may decide not do at all

Even if we never do the second one, built-in ACME support for setting up /wss on own domain is a good match of real life usage (people self-hosting IPFS infra on own domains), and would make things easier for everyone.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vasco-santos for the ping.

Even if we never do the second one, built-in ACME support for setting up /wss on own domain is a good match of real life usage (people self-hosting IPFS infra on own domains), and would make things easier for everyone.

👍 for option 1 being good enough, especially when "go nodes listen on webrtc by default", as browsers could connect to non-ssl Go nodes via WebRTC with the help of a smaller number of SSL + WSS Go nodes as signaling servers using circuit relay v2.

but, we have to consider that if hole punching fails the nodes won't be able to speak.

True. Sorry, in case this is a question already discussed: Is the goal of this proposal with Browser nodes can connect to **any** node out of the box a hard requirement, or is increasing overall connectivity on a best effort basis good enough?

Asked differently would Browser nodes can connect to **most** nodes out of the box, with the remaining nodes being the ones unreachable due to WebRTC NAT hole punching issues, be a goal worth achieving as well? To me 100% connectivity in a peer-to-peer setting seems impossible in the first place, thus I would assume the latter title to be more accurate. What do people think?


#### Assumptions &amp; hypotheses
_What must be true for this project to matter?_
<!--(bullet list)-->

- Dapp developers want browser nodes to exchange pubsub messages across the public network
- Dapp developers want to find IPNS records on the network
- Dapp developers want to fetch content from GO nodes

#### User workflow example
_How would a developer or user use this new capability?_
<!--(short paragraph)-->

#### Impact
_How would this directly contribute to web3 dev stack product-market fit?_

<!--
Explain how this addresses known challenges or opportunities.
What awesome potential impact/outcomes/results will we see if we nail this project?
-->

We had some really good discussions yesterday about the state of Pubsub/IPNS in each runtime environment + what are the gaps for building dapps on our stack out of the box.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there notes from the conversation? I am seeing now that this is WIP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was a wrong copy paste and not intended for the actual proposal. But here are the notes: https://hackmd.io/@gozala/state-of-ipns


#### Leverage
_How much would nailing this project improve our knowledge and ability to execute future projects?_

<!--
Explain the opportunity or leverage point for our subsequent velocity/impact (e.g. by speeding up development, enabling more contributors, etc)
-->

#### Confidence
_How sure are we that this impact would be realized? Label from [this scale](https://medium.com/@nimay/inside-product-introduction-to-feature-priority-using-ice-impact-confidence-ease-and-gist-5180434e5b15)_.

<!--Explain why this rating-->


## Project definition
#### Brief plan of attack

<!--Briefly describe the milestones/steps/work needed for this project-->

#### What does done look like?
_What specific deliverables should completed to consider this project done?_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_What specific deliverables should completed to consider this project done?_
_What specific deliverables should completed to consider this project done?_
- Seamless ACME support to go-ipfs and js-ipfs: entering `/dns4/.../wss/` addr in `Addresses.Swarm` and setting up ACME endpoint for the domain name in something like `ACME.Endpoints` is all the user needs to do to have Secure WebSockets transport enabled.


#### What does success look like?
_Success means impact. How will we know we did the right thing?_
Copy link
Member

@lidel lidel Apr 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_Success means impact. How will we know we did the right thing?_
_Success means impact. How will we know we did the right thing?_
- We see a clear trend of increasing number of `/dns*/.../wss/` addresses announced on the DHT


<!--
Provide success criteria. These might include particular metrics, desired changes in the types of bug reports being filed, desired changes in qualitative user feedback (measured via surveys, etc), etc.
-->

#### Counterpoints &amp; pre-mortem
_Why might this project be lower impact than expected? How could this project fail to complete, or fail to be successful?_
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_Why might this project be lower impact than expected? How could this project fail to complete, or fail to be successful?_
_Why might this project be lower impact than expected? How could this project fail to complete, or fail to be successful?_
- The need for having own domain name for getting TLS cert via ACME endpoint is a good first step, but won't make difference big enough to enable universal connectivity. We may need to provide peers with `{peerid}.libp2p-peer.io` name for TLS and partner with ACME provider to ensure that mining TLS certs for third-parties under our name like that is ok.


#### Alternatives
_How might this project’s intent be realized in other ways (other than this project proposal)? What other potential solutions can address the same need?_

#### Dependencies/prerequisites
<!--List any other projects that are dependencies/prerequisites for this project that is being pitched.-->

#### Future opportunities
<!--What future projects/opportunities could this project enable?-->

## Required resources

#### Effort estimate
<!--T-shirt size rating of the size of the project. If the project might require external collaborators/teams, please note in the roles/skills section below).
For a team of 3-5 people with the appropriate skills:
- Small, 1-2 weeks
- Medium, 3-5 weeks
- Large, 6-10 weeks
- XLarge, >10 weeks
Describe any choices and uncertainty in this scope estimate. (E.g. Uncertainty in the scope until design work is complete, low uncertainty in execution thereafter.)
-->

#### Roles / skills needed
<!--Describe the knowledge/skill-sets and team that are needed for this project (e.g. PM, docs, protocol or library expertise, design expertise, etc.). If this project could be externalized to the community or a team outside PL's direct employment, please note that here.-->