mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Make P2P use JSServer
This commit is contained in:
parent
8bc5084d8d
commit
7353de7dbb
1 changed files with 5 additions and 6 deletions
|
@ -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) {
|
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})
|
node = go_http_js_libp2p.NewP2pLocalNode("org.matrix.p2p.experiment", privKey.Seed(), []string{hosted})
|
||||||
serverName = node.Id
|
serverName = node.Id
|
||||||
fmt.Println("p2p assigned ServerName: ", serverName)
|
fmt.Println("p2p assigned ServerName: ", serverName)
|
||||||
|
@ -145,11 +145,10 @@ func main() {
|
||||||
if node != nil {
|
if node != nil {
|
||||||
go func() {
|
go func() {
|
||||||
logrus.Info("Listening on libp2p-js host ID ", node.Id)
|
logrus.Info("Listening on libp2p-js host ID ", node.Id)
|
||||||
|
s := JSServer{
|
||||||
listener := go_http_js_libp2p.NewP2pListener(node)
|
Mux: http.DefaultServeMux,
|
||||||
defer listener.Close()
|
}
|
||||||
s := &http.Server{}
|
s.ListenAndServe("p2p")
|
||||||
s.Serve(listener)
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue