Closed albrow closed 2 years ago
The main issue with this PR is that any sort of listening requires certificates signed by a CA. So unless everyone is generating Let's Encrypt certs or something for their clients, this basically won't work.
So, @albrow -- that error will happen whenever a client isn't actually serving using a CA-signed cert. That will cause a browser to balk, then throw client errors. In the case of the Go code it looks like these security errors actually throw and terminate the 0x mesh.
I may be mistaken but this seems like a major issue -- as clients who are discovered via a bootnode tell peers of their multiaddrs, and if they're WS will be pro-actively dialed and then cause errors.
@pgebheim While listening on WSS would be a good feature to add to go-ws-transport
, it's not strictly necessary since SSL can be handled via a proxy (e.g. nginx). Our plan is to get our own SSL certificate and use nginx as a proxy for our bootstrap nodes and relay nodes, which will then be able to accept WSS connections. We will rely on these in the near term to establish connections and route traffic between any browser peers in the network. See https://docs.libp2p.io/concepts/circuit-relay/.
In the case of the Go code it looks like these security errors actually throw and terminate the 0x mesh.
I believe Mesh only throws when it can't connect to the bootstrap nodes (since it wouldn't really be able to continue). We should be able to catch the error in any other circumstances and just log it. As an optimization we can potentially detect if we are being hosted on HTTPS and if so not even attempt to dial WS endpoints and only try dialing WSS.
Ok this makes sense re: bootstrap nodes. It seems like in this case it errored even though there are other was bootstrap nodes, I can attempt to verify. But iirc there is a specific error for when no bootstrap nodes are connectable.
It would be nice to filter out non secure dials because or else clients are just doing a lot of work and producing errors.
Oops, GitHub automation had one up their sleeve.
PR to move wss protocol definition: https://github.com/0xProject/go-ws-transport/pull/2
Something I realized when we were discussing using an nginx reverse proxy. transport.Listen("/..../wss")
should return an error.
See #70. This PR adds support for dialing (but not listening on) WSS addresses. Listening can be accomplished via a proxy such as nginx, so I would rather not implement it here for the sake of time. I borrowed some code from https://github.com/libp2p/go-ws-transport/pull/46 (thank you @Jorropo!), addressed some of the concerns from that PR, and added a test which actually dials one of the public bootstrap nodes using WSS.
I'm sure that I am missing some things and there are a few smaller issues to sort out. The basics are working so I decided to go ahead and open a PR.