aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dendrite-appservice-server/main.go6
-rw-r--r--cmd/dendrite-client-api-server/main.go4
-rw-r--r--cmd/dendrite-demo-libp2p/main.go27
-rw-r--r--cmd/dendrite-edu-server/main.go3
-rw-r--r--cmd/dendrite-federation-api-server/main.go4
-rw-r--r--cmd/dendrite-federation-sender-server/main.go3
-rw-r--r--cmd/dendrite-key-server/main.go2
-rw-r--r--cmd/dendrite-media-api-server/main.go2
-rw-r--r--cmd/dendrite-monolith-server/main.go36
-rw-r--r--cmd/dendrite-public-rooms-api-server/main.go2
-rw-r--r--cmd/dendrite-room-server/main.go3
-rw-r--r--cmd/dendrite-server-key-api-server/main.go3
-rw-r--r--cmd/dendrite-sync-api-server/main.go2
-rw-r--r--cmd/dendritejs/main.go22
14 files changed, 63 insertions, 56 deletions
diff --git a/cmd/dendrite-appservice-server/main.go b/cmd/dendrite-appservice-server/main.go
index 4fc2a173..21fb1b79 100644
--- a/cmd/dendrite-appservice-server/main.go
+++ b/cmd/dendrite-appservice-server/main.go
@@ -31,9 +31,9 @@ func main() {
rsAPI := base.RoomserverHTTPClient()
cache := transactions.New()
- appservice.SetupAppServiceAPIComponent(
- base, accountDB, deviceDB, federation, rsAPI, cache,
- )
+ intAPI := appservice.NewInternalAPI(base, accountDB, deviceDB, rsAPI)
+ appservice.AddInternalRoutes(base.InternalAPIMux, intAPI)
+ appservice.AddPublicRoutes(base.PublicAPIMux, base.Cfg, rsAPI, accountDB, federation, cache)
base.SetupAndServeHTTP(string(base.Cfg.Bind.AppServiceAPI), string(base.Cfg.Listen.AppServiceAPI))
diff --git a/cmd/dendrite-client-api-server/main.go b/cmd/dendrite-client-api-server/main.go
index 8ad4231d..58396205 100644
--- a/cmd/dendrite-client-api-server/main.go
+++ b/cmd/dendrite-client-api-server/main.go
@@ -38,8 +38,8 @@ func main() {
fsAPI := base.FederationSenderHTTPClient()
eduInputAPI := base.EDUServerClient()
- clientapi.SetupClientAPIComponent(
- base, deviceDB, accountDB, federation, keyRing,
+ clientapi.AddPublicRoutes(
+ base.PublicAPIMux, base, deviceDB, accountDB, federation, keyRing,
rsAPI, eduInputAPI, asQuery, transactions.New(), fsAPI,
)
diff --git a/cmd/dendrite-demo-libp2p/main.go b/cmd/dendrite-demo-libp2p/main.go
index 86909685..80e2e800 100644
--- a/cmd/dendrite-demo-libp2p/main.go
+++ b/cmd/dendrite-demo-libp2p/main.go
@@ -136,42 +136,41 @@ func main() {
deviceDB := base.Base.CreateDeviceDB()
federation := createFederationClient(base)
- serverKeyAPI := serverkeyapi.SetupServerKeyAPIComponent(
- &base.Base, federation,
+ serverKeyAPI := serverkeyapi.NewInternalAPI(
+ base.Base.Cfg, federation, base.Base.Caches,
)
keyRing := serverKeyAPI.KeyRing()
createKeyDB(
base, serverKeyAPI,
)
- rsAPI := roomserver.SetupRoomServerComponent(
+ rsAPI := roomserver.NewInternalAPI(
&base.Base, keyRing, federation,
)
- eduInputAPI := eduserver.SetupEDUServerComponent(
+ eduInputAPI := eduserver.NewInternalAPI(
&base.Base, cache.New(), deviceDB,
)
- asAPI := appservice.SetupAppServiceAPIComponent(
- &base.Base, accountDB, deviceDB, federation, rsAPI, transactions.New(),
- )
- fsAPI := federationsender.SetupFederationSenderComponent(
+ asAPI := appservice.NewInternalAPI(&base.Base, accountDB, deviceDB, rsAPI)
+ appservice.AddPublicRoutes(base.Base.PublicAPIMux, &cfg, rsAPI, accountDB, federation, transactions.New())
+ fsAPI := federationsender.NewInternalAPI(
&base.Base, federation, rsAPI, keyRing,
)
rsAPI.SetFederationSenderAPI(fsAPI)
- clientapi.SetupClientAPIComponent(
- &base.Base, deviceDB, accountDB,
+ clientapi.AddPublicRoutes(
+ base.Base.PublicAPIMux, &base.Base, deviceDB, accountDB,
federation, keyRing, rsAPI,
eduInputAPI, asAPI, transactions.New(), fsAPI,
)
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
- federationapi.SetupFederationAPIComponent(&base.Base, accountDB, deviceDB, federation, keyRing, rsAPI, asAPI, fsAPI, eduProducer)
- mediaapi.SetupMediaAPIComponent(&base.Base, deviceDB)
+ federationapi.AddPublicRoutes(base.Base.PublicAPIMux, base.Base.Cfg, accountDB, deviceDB, federation, keyRing, rsAPI, asAPI, fsAPI, eduProducer)
+ mediaapi.AddPublicRoutes(base.Base.PublicAPIMux, base.Base.Cfg, deviceDB)
publicRoomsDB, err := storage.NewPublicRoomsServerDatabaseWithPubSub(string(base.Base.Cfg.Database.PublicRoomsAPI), base.LibP2PPubsub, cfg.Matrix.ServerName)
if err != nil {
logrus.WithError(err).Panicf("failed to connect to public rooms db")
}
- publicroomsapi.SetupPublicRoomsAPIComponent(&base.Base, deviceDB, publicRoomsDB, rsAPI, federation, nil) // Check this later
- syncapi.SetupSyncAPIComponent(&base.Base, deviceDB, accountDB, rsAPI, federation, &cfg)
+ publicroomsapi.AddPublicRoutes(base.Base.PublicAPIMux, &base.Base, deviceDB, publicRoomsDB, rsAPI, federation, nil) // Check this later
+ syncapi.AddPublicRoutes(base.Base.PublicAPIMux, &base.Base, deviceDB, accountDB, rsAPI, federation, &cfg)
internal.SetupHTTPAPI(
http.DefaultServeMux,
diff --git a/cmd/dendrite-edu-server/main.go b/cmd/dendrite-edu-server/main.go
index ceeb1365..a86f66c8 100644
--- a/cmd/dendrite-edu-server/main.go
+++ b/cmd/dendrite-edu-server/main.go
@@ -31,7 +31,8 @@ func main() {
}()
deviceDB := base.CreateDeviceDB()
- eduserver.SetupEDUServerComponent(base, cache.New(), deviceDB)
+ intAPI := eduserver.NewInternalAPI(base, cache.New(), deviceDB)
+ eduserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
base.SetupAndServeHTTP(string(base.Cfg.Bind.EDUServer), string(base.Cfg.Listen.EDUServer))
diff --git a/cmd/dendrite-federation-api-server/main.go b/cmd/dendrite-federation-api-server/main.go
index 0c4d8b85..7481299e 100644
--- a/cmd/dendrite-federation-api-server/main.go
+++ b/cmd/dendrite-federation-api-server/main.go
@@ -36,8 +36,8 @@ func main() {
// TODO: this isn't a producer
eduProducer := producers.NewEDUServerProducer(base.EDUServerClient())
- federationapi.SetupFederationAPIComponent(
- base, accountDB, deviceDB, federation, keyRing,
+ federationapi.AddPublicRoutes(
+ base.PublicAPIMux, base.Cfg, accountDB, deviceDB, federation, keyRing,
rsAPI, asAPI, fsAPI, eduProducer,
)
diff --git a/cmd/dendrite-federation-sender-server/main.go b/cmd/dendrite-federation-sender-server/main.go
index 651eb257..7b60ad05 100644
--- a/cmd/dendrite-federation-sender-server/main.go
+++ b/cmd/dendrite-federation-sender-server/main.go
@@ -30,9 +30,10 @@ func main() {
keyRing := serverKeyAPI.KeyRing()
rsAPI := base.RoomserverHTTPClient()
- federationsender.SetupFederationSenderComponent(
+ fsAPI := federationsender.NewInternalAPI(
base, federation, rsAPI, keyRing,
)
+ federationsender.AddInternalRoutes(base.InternalAPIMux, fsAPI)
base.SetupAndServeHTTP(string(base.Cfg.Bind.FederationSender), string(base.Cfg.Listen.FederationSender))
diff --git a/cmd/dendrite-key-server/main.go b/cmd/dendrite-key-server/main.go
index a8accbcb..5dccc300 100644
--- a/cmd/dendrite-key-server/main.go
+++ b/cmd/dendrite-key-server/main.go
@@ -27,7 +27,7 @@ func main() {
accountDB := base.CreateAccountsDB()
deviceDB := base.CreateDeviceDB()
- keyserver.SetupKeyServerComponent(base, deviceDB, accountDB)
+ keyserver.AddPublicRoutes(base.PublicAPIMux, base.Cfg, deviceDB, accountDB)
base.SetupAndServeHTTP(string(base.Cfg.Bind.KeyServer), string(base.Cfg.Listen.KeyServer))
diff --git a/cmd/dendrite-media-api-server/main.go b/cmd/dendrite-media-api-server/main.go
index 01855938..5c65fad0 100644
--- a/cmd/dendrite-media-api-server/main.go
+++ b/cmd/dendrite-media-api-server/main.go
@@ -26,7 +26,7 @@ func main() {
deviceDB := base.CreateDeviceDB()
- mediaapi.SetupMediaAPIComponent(base, deviceDB)
+ mediaapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, deviceDB)
base.SetupAndServeHTTP(string(base.Cfg.Bind.MediaAPI), string(base.Cfg.Listen.MediaAPI))
diff --git a/cmd/dendrite-monolith-server/main.go b/cmd/dendrite-monolith-server/main.go
index 57e8f66f..97fa3a2a 100644
--- a/cmd/dendrite-monolith-server/main.go
+++ b/cmd/dendrite-monolith-server/main.go
@@ -70,62 +70,66 @@ func main() {
deviceDB := base.CreateDeviceDB()
federation := base.CreateFederationClient()
- serverKeyAPI := serverkeyapi.SetupServerKeyAPIComponent(
- base, federation,
+ serverKeyAPI := serverkeyapi.NewInternalAPI(
+ base.Cfg, federation, base.Caches,
)
if base.UseHTTPAPIs {
+ serverkeyapi.AddInternalRoutes(base.InternalAPIMux, serverKeyAPI, base.Caches)
serverKeyAPI = base.ServerKeyAPIClient()
}
keyRing := serverKeyAPI.KeyRing()
- rsComponent := roomserver.SetupRoomServerComponent(
+ rsComponent := roomserver.NewInternalAPI(
base, keyRing, federation,
)
rsAPI := rsComponent
if base.UseHTTPAPIs {
+ roomserver.AddInternalRoutes(base.InternalAPIMux, rsAPI)
rsAPI = base.RoomserverHTTPClient()
}
- eduInputAPI := eduserver.SetupEDUServerComponent(
+ eduInputAPI := eduserver.NewInternalAPI(
base, cache.New(), deviceDB,
)
if base.UseHTTPAPIs {
+ eduserver.AddInternalRoutes(base.InternalAPIMux, eduInputAPI)
eduInputAPI = base.EDUServerClient()
}
- asAPI := appservice.SetupAppServiceAPIComponent(
- base, accountDB, deviceDB, federation, rsAPI, transactions.New(),
- )
+ asAPI := appservice.NewInternalAPI(base, accountDB, deviceDB, rsAPI)
+ appservice.AddPublicRoutes(base.PublicAPIMux, cfg, rsAPI, accountDB, federation, transactions.New())
if base.UseHTTPAPIs {
+ appservice.AddInternalRoutes(base.InternalAPIMux, asAPI)
asAPI = base.AppserviceHTTPClient()
}
- fsAPI := federationsender.SetupFederationSenderComponent(
+ fsAPI := federationsender.NewInternalAPI(
base, federation, rsAPI, keyRing,
)
if base.UseHTTPAPIs {
+ federationsender.AddInternalRoutes(base.InternalAPIMux, fsAPI)
fsAPI = base.FederationSenderHTTPClient()
}
rsComponent.SetFederationSenderAPI(fsAPI)
- clientapi.SetupClientAPIComponent(
- base, deviceDB, accountDB,
+ clientapi.AddPublicRoutes(
+ base.PublicAPIMux, base, deviceDB, accountDB,
federation, keyRing, rsAPI,
eduInputAPI, asAPI, transactions.New(), fsAPI,
)
- keyserver.SetupKeyServerComponent(
- base, deviceDB, accountDB,
+ keyserver.AddPublicRoutes(
+ base.PublicAPIMux, base.Cfg, deviceDB, accountDB,
)
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
- federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, keyRing, rsAPI, asAPI, fsAPI, eduProducer)
- mediaapi.SetupMediaAPIComponent(base, deviceDB)
+ federationapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, accountDB, deviceDB, federation, keyRing, rsAPI, asAPI, fsAPI, eduProducer)
+ mediaapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, deviceDB)
publicRoomsDB, err := storage.NewPublicRoomsServerDatabase(string(base.Cfg.Database.PublicRoomsAPI), base.Cfg.DbProperties(), cfg.Matrix.ServerName)
if err != nil {
logrus.WithError(err).Panicf("failed to connect to public rooms db")
}
- publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, federation, nil)
- syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg)
+ publicroomsapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, publicRoomsDB, rsAPI, federation, nil)
+ syncapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, accountDB, rsAPI, federation, cfg)
internal.SetupHTTPAPI(
http.DefaultServeMux,
diff --git a/cmd/dendrite-public-rooms-api-server/main.go b/cmd/dendrite-public-rooms-api-server/main.go
index 0cad3670..413d7ecb 100644
--- a/cmd/dendrite-public-rooms-api-server/main.go
+++ b/cmd/dendrite-public-rooms-api-server/main.go
@@ -34,7 +34,7 @@ func main() {
if err != nil {
logrus.WithError(err).Panicf("failed to connect to public rooms db")
}
- publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, nil, nil)
+ publicroomsapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, publicRoomsDB, rsAPI, nil, nil)
base.SetupAndServeHTTP(string(base.Cfg.Bind.PublicRoomsAPI), string(base.Cfg.Listen.PublicRoomsAPI))
diff --git a/cmd/dendrite-room-server/main.go b/cmd/dendrite-room-server/main.go
index 79745cde..a2f1e941 100644
--- a/cmd/dendrite-room-server/main.go
+++ b/cmd/dendrite-room-server/main.go
@@ -29,8 +29,9 @@ func main() {
keyRing := serverKeyAPI.KeyRing()
fsAPI := base.FederationSenderHTTPClient()
- rsAPI := roomserver.SetupRoomServerComponent(base, keyRing, federation)
+ rsAPI := roomserver.NewInternalAPI(base, keyRing, federation)
rsAPI.SetFederationSenderAPI(fsAPI)
+ roomserver.AddInternalRoutes(base.InternalAPIMux, rsAPI)
base.SetupAndServeHTTP(string(base.Cfg.Bind.RoomServer), string(base.Cfg.Listen.RoomServer))
diff --git a/cmd/dendrite-server-key-api-server/main.go b/cmd/dendrite-server-key-api-server/main.go
index e206978c..b4bfcbff 100644
--- a/cmd/dendrite-server-key-api-server/main.go
+++ b/cmd/dendrite-server-key-api-server/main.go
@@ -26,7 +26,8 @@ func main() {
federation := base.CreateFederationClient()
- serverkeyapi.SetupServerKeyAPIComponent(base, federation)
+ intAPI := serverkeyapi.NewInternalAPI(base.Cfg, federation, base.Caches)
+ serverkeyapi.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
base.SetupAndServeHTTP(string(base.Cfg.Bind.ServerKeyAPI), string(base.Cfg.Listen.ServerKeyAPI))
}
diff --git a/cmd/dendrite-sync-api-server/main.go b/cmd/dendrite-sync-api-server/main.go
index bb56b4ab..4ad68c5e 100644
--- a/cmd/dendrite-sync-api-server/main.go
+++ b/cmd/dendrite-sync-api-server/main.go
@@ -30,7 +30,7 @@ func main() {
rsAPI := base.RoomserverHTTPClient()
- syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg)
+ syncapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, accountDB, rsAPI, federation, cfg)
base.SetupAndServeHTTP(string(base.Cfg.Bind.SyncAPI), string(base.Cfg.Listen.SyncAPI))
diff --git a/cmd/dendritejs/main.go b/cmd/dendritejs/main.go
index 4c1b8197..9c6c7c03 100644
--- a/cmd/dendritejs/main.go
+++ b/cmd/dendritejs/main.go
@@ -206,29 +206,29 @@ func main() {
KeyDatabase: fetcher,
}
- rsAPI := roomserver.SetupRoomServerComponent(base, keyRing, federation)
- eduInputAPI := eduserver.SetupEDUServerComponent(base, cache.New(), deviceDB)
- asQuery := appservice.SetupAppServiceAPIComponent(
- base, accountDB, deviceDB, federation, rsAPI, transactions.New(),
+ rsAPI := roomserver.NewInternalAPI(base, keyRing, federation)
+ eduInputAPI := eduserver.NewInternalAPI(base, cache.New(), deviceDB)
+ asQuery := appservice.NewInternalAPI(
+ base, accountDB, deviceDB, rsAPI,
)
- fedSenderAPI := federationsender.SetupFederationSenderComponent(base, federation, rsAPI, &keyRing)
+ fedSenderAPI := federationsender.NewInternalAPI(base, federation, rsAPI, &keyRing)
rsAPI.SetFederationSenderAPI(fedSenderAPI)
p2pPublicRoomProvider := NewLibP2PPublicRoomsProvider(node, fedSenderAPI)
- clientapi.SetupClientAPIComponent(
- base, deviceDB, accountDB,
+ clientapi.AddPublicRoutes(
+ base.PublicAPIMux, base, deviceDB, accountDB,
federation, &keyRing, rsAPI,
eduInputAPI, asQuery, transactions.New(), fedSenderAPI,
)
eduProducer := producers.NewEDUServerProducer(eduInputAPI)
- federationapi.SetupFederationAPIComponent(base, accountDB, deviceDB, federation, &keyRing, rsAPI, asQuery, fedSenderAPI, eduProducer)
- mediaapi.SetupMediaAPIComponent(base, deviceDB)
+ federationapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, accountDB, deviceDB, federation, &keyRing, rsAPI, asQuery, fedSenderAPI, eduProducer)
+ mediaapi.AddPublicRoutes(base.PublicAPIMux, base.Cfg, deviceDB)
publicRoomsDB, err := storage.NewPublicRoomsServerDatabase(string(base.Cfg.Database.PublicRoomsAPI), cfg.Matrix.ServerName)
if err != nil {
logrus.WithError(err).Panicf("failed to connect to public rooms db")
}
- publicroomsapi.SetupPublicRoomsAPIComponent(base, deviceDB, publicRoomsDB, rsAPI, federation, p2pPublicRoomProvider)
- syncapi.SetupSyncAPIComponent(base, deviceDB, accountDB, rsAPI, federation, cfg)
+ publicroomsapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, publicRoomsDB, rsAPI, federation, p2pPublicRoomProvider)
+ syncapi.AddPublicRoutes(base.PublicAPIMux, base, deviceDB, accountDB, rsAPI, federation, cfg)
internal.SetupHTTPAPI(
http.DefaultServeMux,