aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlex Chen <Cnly@users.noreply.github.com>2019-10-02 00:09:47 +0800
committerGitHub <noreply@github.com>2019-10-02 00:09:47 +0800
commite239fb10f36662d38ab9d1cad5a0bc65518c1704 (patch)
tree8cbaad35e3ea31bd6198e8da923e0b918d73e6b9 /common
parent49fd47c86313f036da3a9549e7d14def166f4ea7 (diff)
Add missing servers field in /directory/room/:alias response (#732)
Diffstat (limited to 'common')
-rw-r--r--common/basecomponent/base.go7
-rw-r--r--common/config/config.go9
2 files changed, 16 insertions, 0 deletions
diff --git a/common/basecomponent/base.go b/common/basecomponent/base.go
index 6a20aca3..503134b2 100644
--- a/common/basecomponent/base.go
+++ b/common/basecomponent/base.go
@@ -32,6 +32,7 @@ import (
appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
"github.com/matrix-org/dendrite/common/config"
+ federationSenderAPI "github.com/matrix-org/dendrite/federationsender/api"
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
typingServerAPI "github.com/matrix-org/dendrite/typingserver/api"
"github.com/sirupsen/logrus"
@@ -107,6 +108,12 @@ func (b *BaseDendrite) CreateHTTPTypingServerAPIs() typingServerAPI.TypingServer
return typingServerAPI.NewTypingServerInputAPIHTTP(b.Cfg.TypingServerURL(), nil)
}
+// CreateHTTPFederationSenderAPIs returns FederationSenderQueryAPI for hitting
+// the federation sender over HTTP
+func (b *BaseDendrite) CreateHTTPFederationSenderAPIs() federationSenderAPI.FederationSenderQueryAPI {
+ return federationSenderAPI.NewFederationSenderQueryAPIHTTP(b.Cfg.FederationSenderURL(), nil)
+}
+
// CreateDeviceDB creates a new instance of the device database. Should only be
// called once per component.
func (b *BaseDendrite) CreateDeviceDB() *devices.Database {
diff --git a/common/config/config.go b/common/config/config.go
index 40232fb0..16cf2640 100644
--- a/common/config/config.go
+++ b/common/config/config.go
@@ -678,6 +678,15 @@ func (config *Dendrite) TypingServerURL() string {
return "http://" + string(config.Listen.TypingServer)
}
+// FederationSenderURL returns an HTTP URL for where the federation sender is listening.
+func (config *Dendrite) FederationSenderURL() string {
+ // Hard code the typing server to talk HTTP for now.
+ // If we support HTTPS we need to think of a practical way to do certificate validation.
+ // People setting up servers shouldn't need to get a certificate valid for the public
+ // internet for an internal API.
+ return "http://" + string(config.Listen.FederationSender)
+}
+
// SetupTracing configures the opentracing using the supplied configuration.
func (config *Dendrite) SetupTracing(serviceName string) (closer io.Closer, err error) {
return config.Tracing.Jaeger.InitGlobalTracer(