cBournhonesque / lightyear

A networking library to make multiplayer games for the Bevy game engine
https://cbournhonesque.github.io/lightyear/book
Apache License 2.0
480 stars 48 forks source link

ERR_SSL_PROTOCOL_ERROR with simple_box instructions #629

Open mwbryant opened 2 months ago

mwbryant commented 2 months ago

When following the instructions for the example I can open the game in a browser locally and it works great. Once I try connecting from my laptop I need to use https for WebTransport to be defined.

I believe I have everything setup as the instructions say and have tried added a Trunk.toml pointing at the cert/keys to no avail.

localhost sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

Is all the browser gives me and I'm a bit out of my depth to debug this.

curl gives:

curl -v https://localhost:8080
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* (5454) (IN), , Unknown (72):
* error:0A00010B:SSL routines::wrong version number
* Closing connection 0
curl: (35) error:0A00010B:SSL routines::wrong version number

But I'm worried that's a red herring. Any ideas or suggestions for debugging?

cBournhonesque commented 2 months ago

The cert/keys are only valid for 14 days (as per webtransport spec) so the ones that are committed to the repo are probably invalid. You will need to regenerate the cert/keys for it to work, you can find some instructions here: https://github.com/cBournhonesque/lightyear/tree/main/examples#testing-in-wasm-with-webtransport

mwbryant commented 2 months ago

I followed those and regenerated the keys (they files show as modified in git) but I still see the same issue. I was able to work around by using the other transport options in the toml