aboutsummaryrefslogtreecommitdiff
path: root/federationapi/routing/routing.go
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-01-23 17:55:12 +0000
committerGitHub <noreply@github.com>2023-01-23 17:55:12 +0000
commit5b73592f5a4dddf64184fcbe33f4c1835c656480 (patch)
treeb6dac51b6be7a1e591f24881ee1bfae1b92088e9 /federationapi/routing/routing.go
parent48fa869fa3578741d1d5775d30f24f6b097ab995 (diff)
Initial Store & Forward Implementation (#2917)
This adds store & forward relays into dendrite for p2p. A few things have changed: - new relay api serves new http endpoints for s&f federation - updated outbound federation queueing which will attempt to forward using s&f if appropriate - database entries to track s&f relays for other nodes
Diffstat (limited to 'federationapi/routing/routing.go')
-rw-r--r--federationapi/routing/routing.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go
index 04eb3d06..5eb30c6e 100644
--- a/federationapi/routing/routing.go
+++ b/federationapi/routing/routing.go
@@ -41,6 +41,12 @@ import (
"github.com/sirupsen/logrus"
)
+const (
+ SendRouteName = "Send"
+ QueryDirectoryRouteName = "QueryDirectory"
+ QueryProfileRouteName = "QueryProfile"
+)
+
// Setup registers HTTP handlers with the given ServeMux.
// The provided publicAPIMux MUST have `UseEncodedPath()` enabled or else routes will incorrectly
// path unescape twice (once from the router, once from MakeFedAPI). We need to have this enabled
@@ -68,7 +74,7 @@ func Setup(
if base.EnableMetrics {
prometheus.MustRegister(
- pduCountTotal, eduCountTotal,
+ internal.PDUCountTotal, internal.EDUCountTotal,
)
}
@@ -138,7 +144,7 @@ func Setup(
cfg, rsAPI, keyAPI, keys, federation, mu, servers, producer,
)
},
- )).Methods(http.MethodPut, http.MethodOptions)
+ )).Methods(http.MethodPut, http.MethodOptions).Name(SendRouteName)
v1fedmux.Handle("/invite/{roomID}/{eventID}", MakeFedAPI(
"federation_invite", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup,
@@ -248,7 +254,7 @@ func Setup(
httpReq, federation, cfg, rsAPI, fsAPI,
)
},
- )).Methods(http.MethodGet)
+ )).Methods(http.MethodGet).Name(QueryDirectoryRouteName)
v1fedmux.Handle("/query/profile", MakeFedAPI(
"federation_query_profile", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup,
@@ -257,7 +263,7 @@ func Setup(
httpReq, userAPI, cfg,
)
},
- )).Methods(http.MethodGet)
+ )).Methods(http.MethodGet).Name(QueryProfileRouteName)
v1fedmux.Handle("/user/devices/{userID}", MakeFedAPI(
"federation_user_devices", cfg.Matrix.ServerName, cfg.Matrix.IsLocalServerName, keys, wakeup,