From 7353de7dbb146a16696cf2e9683753c3b08291f2 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Fri, 13 Mar 2020 10:15:01 +0000 Subject: [PATCH] Make P2P use JSServer --- cmd/dendritejs/main.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go index 458427a7..25492b16 100644 --- a/cmd/dendritejs/main.go +++ b/cmd/dendritejs/main.go @@ -69,7 +69,7 @@ func createFederationClient(cfg *config.Dendrite, node *go_http_js_libp2p.P2pLoc } func createP2PNode(privKey ed25519.PrivateKey) (serverName string, node *go_http_js_libp2p.P2pLocalNode) { - hosted := "/ip4/127.0.0.1/tcp/9090/ws/p2p-websocket-star/" + hosted := "/dns4/rendezvous.matrix.org/tcp/8443/wss/p2p-websocket-star/" node = go_http_js_libp2p.NewP2pLocalNode("org.matrix.p2p.experiment", privKey.Seed(), []string{hosted}) serverName = node.Id fmt.Println("p2p assigned ServerName: ", serverName) @@ -145,11 +145,10 @@ func main() { if node != nil { go func() { logrus.Info("Listening on libp2p-js host ID ", node.Id) - - listener := go_http_js_libp2p.NewP2pListener(node) - defer listener.Close() - s := &http.Server{} - s.Serve(listener) + s := JSServer{ + Mux: http.DefaultServeMux, + } + s.ListenAndServe("p2p") }() }