We'll need a second constructor to instantiate the WebSockets Secure Transport. This constructor will require the certificate, keyfile and anything that ServeTLS needs. I suggest to make it a higher-order function that takes such parameters, and returns a function compatible with go-libp2p.TransportConstructor. Comment here if you need help with figuring this out.
On the dialing side, it should be trivial. We just need to accept /wss addresses. Have a look at this PR that attempted to introduce WSS support in the past (albeit under a radically different codebase), to see how the multiaddr stuff was implemented: #46.
This should be fairly easy now that we've migrated gorilla/websocket.
On the listening side, see https://github.com/gorilla/websocket/issues/528 for details on how to achieve this. Basically, we need to call
http.ServeTLS()
around here: https://github.com/libp2p/go-ws-transport/blob/3098bba549e89efc42055199c2dca3d95ac70744/listener.go#L25We'll need a second constructor to instantiate the WebSockets Secure Transport. This constructor will require the certificate, keyfile and anything that ServeTLS needs. I suggest to make it a higher-order function that takes such parameters, and returns a function compatible with
go-libp2p.TransportConstructor
. Comment here if you need help with figuring this out.On the dialing side, it should be trivial. We just need to accept
/wss
addresses. Have a look at this PR that attempted to introduce WSS support in the past (albeit under a radically different codebase), to see how the multiaddr stuff was implemented: #46.