This commit is contained in:
Matthew Hodgson 2020-01-25 19:35:46 -07:00
parent 8a52f2afdc
commit 90a96c698c
3 changed files with 9 additions and 4 deletions

View file

@ -17,6 +17,7 @@ package basecomponent
import (
"database/sql"
"io"
"fmt"
"net/http"
"github.com/matrix-org/dendrite/common/keydb"
@ -74,7 +75,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string) *BaseDendrite {
var node *go_http_js_libp2p.P2pLocalNode
if cfg.Matrix.ServerName == "p2p-js" {
node = go_http_js_libp2p.NewP2pLocalNode("org.matrix.p2p.experiment")
node = go_http_js_libp2p.NewP2pLocalNode("org.matrix.p2p.experiment", []string{"/ip4/127.0.0.1/tcp/9090/ws/p2p-websocket-star/"})
cfg.Matrix.ServerName = gomatrixserverlib.ServerName(node.Id)
}
@ -161,10 +162,10 @@ func (b *BaseDendrite) CreateKeyDB() keydb.Database {
// CreateFederationClient creates a new federation client. Should only be called
// once per component.
func (b *BaseDendrite) CreateFederationClient() *gomatrixserverlib.FederationClient {
if b.P2PLocalNode != nil {
if b.P2pLocalNode != nil {
fmt.Println("Running in js-libp2p federation mode")
fmt.Println("Warning: Federation with non-libp2p homeservers will not work in this mode yet!")
tr := go_http_js_libp2p.NewP2pTransport(b.P2PLocalNode)
tr := go_http_js_libp2p.NewP2pTransport(b.P2pLocalNode)
return gomatrixserverlib.NewFederationClientWithTransport(
b.Cfg.Matrix.ServerName, b.Cfg.Matrix.KeyID, b.Cfg.Matrix.PrivateKey, tr,
)

4
go.mod
View file

@ -25,7 +25,7 @@ require (
github.com/matrix-org/dugong v0.0.0-20171220115018-ea0a4690a0d5
github.com/matrix-org/go-http-js-libp2p v0.0.0-20200125063821-6eb06b102bda
github.com/matrix-org/gomatrix v0.0.0-20190528120928-7df988a63f26
github.com/matrix-org/gomatrixserverlib v0.0.0-20190814163046-d6285a18401f
github.com/matrix-org/gomatrixserverlib v0.0.0-20200124100636-0c2ec91d1df5
github.com/matrix-org/naffka v0.0.0-20171115094957-662bfd0841d0
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5
github.com/matttproud/golang_protobuf_extensions v1.0.1
@ -67,4 +67,6 @@ require (
gopkg.in/yaml.v2 v2.2.2
)
replace github.com/matrix-org/go-http-js-libp2p v0.0.0-20200125063821-6eb06b102bda => ../go-http-js-libp2p
go 1.13

2
go.sum
View file

@ -88,6 +88,8 @@ github.com/matrix-org/gomatrixserverlib v0.0.0-20190805173246-3a2199d5ecd6 h1:xr
github.com/matrix-org/gomatrixserverlib v0.0.0-20190805173246-3a2199d5ecd6/go.mod h1:sf0RcKOdiwJeTti7A313xsaejNUGYDq02MQZ4JD4w/E=
github.com/matrix-org/gomatrixserverlib v0.0.0-20190814163046-d6285a18401f h1:20CZL7ApB7xgR7sZF9yD/qpsP51Sfx0TTgUJ3vKgnZQ=
github.com/matrix-org/gomatrixserverlib v0.0.0-20190814163046-d6285a18401f/go.mod h1:sf0RcKOdiwJeTti7A313xsaejNUGYDq02MQZ4JD4w/E=
github.com/matrix-org/gomatrixserverlib v0.0.0-20200124100636-0c2ec91d1df5 h1:kmRjpmFOenVpOaV/DRlo9p6z/IbOKlUC+hhKsAAh8Qg=
github.com/matrix-org/gomatrixserverlib v0.0.0-20200124100636-0c2ec91d1df5/go.mod h1:FsKa2pWE/bpQql9H7U4boOPXFoJX/QcqaZZ6ijLkaZI=
github.com/matrix-org/naffka v0.0.0-20171115094957-662bfd0841d0 h1:p7WTwG+aXM86+yVrYAiCMW3ZHSmotVvuRbjtt3jC+4A=
github.com/matrix-org/naffka v0.0.0-20171115094957-662bfd0841d0/go.mod h1:cXoYQIENbdWIQHt1SyCo6Bl3C3raHwJ0wgVrXHSqf+A=
github.com/matrix-org/util v0.0.0-20171013132526-8b1c8ab81986 h1:TiWl4hLvezAhRPM8tPcPDFTysZ7k4T/1J4GPp/iqlZo=