aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordevonh <devon.dmytro@gmail.com>2023-04-24 16:23:25 +0000
committerGitHub <noreply@github.com>2023-04-24 16:23:25 +0000
commited19efc5d751446a57727c0880437d95be26ba9d (patch)
tree9c779c3d5df6b06afa0315e24e23b7a650a2a4b0
parent4679098a6415ea8bfb7728ddafa587780849c059 (diff)
Move fedclient interface over to gmsl (#3061)
Companion PR: https://github.com/matrix-org/gomatrixserverlib/pull/366
-rw-r--r--clientapi/clientapi.go2
-rw-r--r--clientapi/routing/directory.go2
-rw-r--r--clientapi/routing/directory_public.go2
-rw-r--r--clientapi/routing/profile.go8
-rw-r--r--clientapi/routing/routing.go2
-rw-r--r--clientapi/routing/userdirectory.go2
-rw-r--r--cmd/dendrite-demo-pinecone/conn/client.go2
-rw-r--r--cmd/dendrite-demo-pinecone/rooms/rooms.go6
-rw-r--r--cmd/dendrite-demo-pinecone/users/users.go6
-rw-r--r--cmd/dendrite-demo-yggdrasil/yggconn/client.go2
-rw-r--r--cmd/dendrite-demo-yggdrasil/yggrooms/yggrooms.go6
-rw-r--r--federationapi/api/api.go36
-rw-r--r--federationapi/federationapi.go4
-rw-r--r--federationapi/federationapi_keys_test.go2
-rw-r--r--federationapi/federationapi_test.go2
-rw-r--r--federationapi/internal/api.go5
-rw-r--r--federationapi/internal/perform.go2
-rw-r--r--federationapi/internal/perform_test.go2
-rw-r--r--federationapi/queue/destinationqueue.go3
-rw-r--r--federationapi/queue/queue.go5
-rw-r--r--federationapi/queue/queue_test.go3
-rw-r--r--federationapi/routing/query.go2
-rw-r--r--federationapi/routing/query_test.go3
-rw-r--r--federationapi/routing/routing.go2
-rw-r--r--federationapi/routing/send.go2
-rw-r--r--federationapi/routing/threepid.go9
-rw-r--r--go.mod2
-rw-r--r--go.sum28
-rw-r--r--relayapi/internal/api.go6
-rw-r--r--relayapi/internal/perform_test.go3
-rw-r--r--relayapi/relayapi.go2
-rw-r--r--setup/base/base.go4
-rw-r--r--setup/monolith.go2
-rw-r--r--userapi/internal/device_list_update_test.go4
34 files changed, 53 insertions, 120 deletions
diff --git a/clientapi/clientapi.go b/clientapi/clientapi.go
index b57c8061..aee16eb0 100644
--- a/clientapi/clientapi.go
+++ b/clientapi/clientapi.go
@@ -37,7 +37,7 @@ func AddPublicRoutes(
routers httputil.Routers,
cfg *config.Dendrite,
natsInstance *jetstream.NATSInstance,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
rsAPI roomserverAPI.ClientRoomserverAPI,
asAPI appserviceAPI.AppServiceInternalAPI,
transactionsCache *transactions.Cache,
diff --git a/clientapi/routing/directory.go b/clientapi/routing/directory.go
index e108f3cf..9dd2d7cd 100644
--- a/clientapi/routing/directory.go
+++ b/clientapi/routing/directory.go
@@ -47,7 +47,7 @@ func (r *roomDirectoryResponse) fillServers(servers []spec.ServerName) {
func DirectoryRoom(
req *http.Request,
roomAlias string,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
cfg *config.ClientAPI,
rsAPI roomserverAPI.ClientRoomserverAPI,
fedSenderAPI federationAPI.ClientFederationAPI,
diff --git a/clientapi/routing/directory_public.go b/clientapi/routing/directory_public.go
index 0616e79e..c150d908 100644
--- a/clientapi/routing/directory_public.go
+++ b/clientapi/routing/directory_public.go
@@ -57,7 +57,7 @@ type filter struct {
func GetPostPublicRooms(
req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI,
extRoomsProvider api.ExtraPublicRoomsProvider,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
cfg *config.ClientAPI,
) util.JSONResponse {
var request PublicRoomReq
diff --git a/clientapi/routing/profile.go b/clientapi/routing/profile.go
index 6d1a0824..0652c9b0 100644
--- a/clientapi/routing/profile.go
+++ b/clientapi/routing/profile.go
@@ -41,7 +41,7 @@ func GetProfile(
req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
userID string,
asAPI appserviceAPI.AppServiceInternalAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
) util.JSONResponse {
profile, err := getProfile(req.Context(), profileAPI, cfg, userID, asAPI, federation)
if err != nil {
@@ -69,7 +69,7 @@ func GetProfile(
func GetAvatarURL(
req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
userID string, asAPI appserviceAPI.AppServiceInternalAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
) util.JSONResponse {
profile := GetProfile(req, profileAPI, cfg, userID, asAPI, federation)
p, ok := profile.JSON.(eventutil.UserProfile)
@@ -158,7 +158,7 @@ func SetAvatarURL(
func GetDisplayName(
req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
userID string, asAPI appserviceAPI.AppServiceInternalAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
) util.JSONResponse {
profile := GetProfile(req, profileAPI, cfg, userID, asAPI, federation)
p, ok := profile.JSON.(eventutil.UserProfile)
@@ -294,7 +294,7 @@ func getProfile(
ctx context.Context, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
userID string,
asAPI appserviceAPI.AppServiceInternalAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
) (*authtypes.Profile, error) {
localpart, domain, err := gomatrixserverlib.SplitID('@', userID)
if err != nil {
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 9bf9ac80..aa9b41fc 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -56,7 +56,7 @@ func Setup(
asAPI appserviceAPI.AppServiceInternalAPI,
userAPI userapi.ClientUserAPI,
userDirectoryProvider userapi.QuerySearchProfilesAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
syncProducer *producers.SyncAPIProducer,
transactionsCache *transactions.Cache,
federationSender federationAPI.ClientFederationAPI,
diff --git a/clientapi/routing/userdirectory.go b/clientapi/routing/userdirectory.go
index 0d021c7a..32cefde6 100644
--- a/clientapi/routing/userdirectory.go
+++ b/clientapi/routing/userdirectory.go
@@ -43,7 +43,7 @@ func SearchUserDirectory(
provider userapi.QuerySearchProfilesAPI,
searchString string,
limit int,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
localServerName spec.ServerName,
) util.JSONResponse {
if limit < 10 {
diff --git a/cmd/dendrite-demo-pinecone/conn/client.go b/cmd/dendrite-demo-pinecone/conn/client.go
index 4571de15..5d1417dd 100644
--- a/cmd/dendrite-demo-pinecone/conn/client.go
+++ b/cmd/dendrite-demo-pinecone/conn/client.go
@@ -99,7 +99,7 @@ func CreateClient(
func CreateFederationClient(
cfg *config.Dendrite, s *pineconeSessions.Sessions,
-) *fclient.FederationClient {
+) fclient.FederationClient {
return fclient.NewFederationClient(
cfg.Global.SigningIdentities(),
fclient.WithTransport(createTransport(s)),
diff --git a/cmd/dendrite-demo-pinecone/rooms/rooms.go b/cmd/dendrite-demo-pinecone/rooms/rooms.go
index 73423ef6..57282a00 100644
--- a/cmd/dendrite-demo-pinecone/rooms/rooms.go
+++ b/cmd/dendrite-demo-pinecone/rooms/rooms.go
@@ -33,14 +33,14 @@ type PineconeRoomProvider struct {
r *pineconeRouter.Router
s *pineconeSessions.Sessions
fedSender api.FederationInternalAPI
- fedClient *fclient.FederationClient
+ fedClient fclient.FederationClient
}
func NewPineconeRoomProvider(
r *pineconeRouter.Router,
s *pineconeSessions.Sessions,
fedSender api.FederationInternalAPI,
- fedClient *fclient.FederationClient,
+ fedClient fclient.FederationClient,
) *PineconeRoomProvider {
p := &PineconeRoomProvider{
r: r,
@@ -68,7 +68,7 @@ func (p *PineconeRoomProvider) Rooms() []fclient.PublicRoom {
// bulkFetchPublicRoomsFromServers fetches public rooms from the list of homeservers.
// Returns a list of public rooms.
func bulkFetchPublicRoomsFromServers(
- ctx context.Context, fedClient *fclient.FederationClient,
+ ctx context.Context, fedClient fclient.FederationClient,
origin spec.ServerName,
homeservers map[spec.ServerName]struct{},
) (publicRooms []fclient.PublicRoom) {
diff --git a/cmd/dendrite-demo-pinecone/users/users.go b/cmd/dendrite-demo-pinecone/users/users.go
index 9c844ab6..079df328 100644
--- a/cmd/dendrite-demo-pinecone/users/users.go
+++ b/cmd/dendrite-demo-pinecone/users/users.go
@@ -39,7 +39,7 @@ type PineconeUserProvider struct {
r *pineconeRouter.Router
s *pineconeSessions.Sessions
userAPI userapi.QuerySearchProfilesAPI
- fedClient *fclient.FederationClient
+ fedClient fclient.FederationClient
}
const PublicURL = "/_matrix/p2p/profiles"
@@ -48,7 +48,7 @@ func NewPineconeUserProvider(
r *pineconeRouter.Router,
s *pineconeSessions.Sessions,
userAPI userapi.QuerySearchProfilesAPI,
- fedClient *fclient.FederationClient,
+ fedClient fclient.FederationClient,
) *PineconeUserProvider {
p := &PineconeUserProvider{
r: r,
@@ -95,7 +95,7 @@ func (p *PineconeUserProvider) QuerySearchProfiles(ctx context.Context, req *use
// Returns a list of user profiles.
func bulkFetchUserDirectoriesFromServers(
ctx context.Context, req *userapi.QuerySearchProfilesRequest,
- fedClient *fclient.FederationClient,
+ fedClient fclient.FederationClient,
homeservers map[spec.ServerName]struct{},
) (profiles []authtypes.Profile) {
jsonBody, err := json.Marshal(req)
diff --git a/cmd/dendrite-demo-yggdrasil/yggconn/client.go b/cmd/dendrite-demo-yggdrasil/yggconn/client.go
index c25acf2e..e1dc0f66 100644
--- a/cmd/dendrite-demo-yggdrasil/yggconn/client.go
+++ b/cmd/dendrite-demo-yggdrasil/yggconn/client.go
@@ -38,7 +38,7 @@ func (n *Node) CreateClient() *fclient.Client {
func (n *Node) CreateFederationClient(
cfg *config.Dendrite,
-) *fclient.FederationClient {
+) fclient.FederationClient {
tr := &http.Transport{}
tr.RegisterProtocol(
"matrix", &yggroundtripper{
diff --git a/cmd/dendrite-demo-yggdrasil/yggrooms/yggrooms.go b/cmd/dendrite-demo-yggdrasil/yggrooms/yggrooms.go
index f838dea0..7ebecb65 100644
--- a/cmd/dendrite-demo-yggdrasil/yggrooms/yggrooms.go
+++ b/cmd/dendrite-demo-yggdrasil/yggrooms/yggrooms.go
@@ -29,11 +29,11 @@ import (
type YggdrasilRoomProvider struct {
node *yggconn.Node
fedSender api.FederationInternalAPI
- fedClient *fclient.FederationClient
+ fedClient fclient.FederationClient
}
func NewYggdrasilRoomProvider(
- node *yggconn.Node, fedSender api.FederationInternalAPI, fedClient *fclient.FederationClient,
+ node *yggconn.Node, fedSender api.FederationInternalAPI, fedClient fclient.FederationClient,
) *YggdrasilRoomProvider {
p := &YggdrasilRoomProvider{
node: node,
@@ -54,7 +54,7 @@ func (p *YggdrasilRoomProvider) Rooms() []fclient.PublicRoom {
// bulkFetchPublicRoomsFromServers fetches public rooms from the list of homeservers.
// Returns a list of public rooms.
func bulkFetchPublicRoomsFromServers(
- ctx context.Context, fedClient *fclient.FederationClient,
+ ctx context.Context, fedClient fclient.FederationClient,
origin spec.ServerName,
homeservers []spec.ServerName,
) (publicRooms []fclient.PublicRoom) {
diff --git a/federationapi/api/api.go b/federationapi/api/api.go
index 6b09b0cd..0048b4b0 100644
--- a/federationapi/api/api.go
+++ b/federationapi/api/api.go
@@ -105,42 +105,6 @@ type KeyserverFederationAPI interface {
QueryKeys(ctx context.Context, origin, s spec.ServerName, keys map[string][]string) (res fclient.RespQueryKeys, err error)
}
-// an interface for gmsl.FederationClient - contains functions called by federationapi only.
-type FederationClient interface {
- P2PFederationClient
- gomatrixserverlib.KeyClient
- SendTransaction(ctx context.Context, t gomatrixserverlib.Transaction) (res fclient.RespSend, err error)
-
- // Perform operations
- LookupRoomAlias(ctx context.Context, origin, s spec.ServerName, roomAlias string) (res fclient.RespDirectory, err error)
- Peek(ctx context.Context, origin, s spec.ServerName, roomID, peekID string, roomVersions []gomatrixserverlib.RoomVersion) (res fclient.RespPeek, err error)
- MakeJoin(ctx context.Context, origin, s spec.ServerName, roomID, userID string, roomVersions []gomatrixserverlib.RoomVersion) (res fclient.RespMakeJoin, err error)
- SendJoin(ctx context.Context, origin, s spec.ServerName, event *gomatrixserverlib.Event) (res fclient.RespSendJoin, err error)
- MakeLeave(ctx context.Context, origin, s spec.ServerName, roomID, userID string) (res fclient.RespMakeLeave, err error)
- SendLeave(ctx context.Context, origin, s spec.ServerName, event *gomatrixserverlib.Event) (err error)
- SendInviteV2(ctx context.Context, origin, s spec.ServerName, request fclient.InviteV2Request) (res fclient.RespInviteV2, err error)
-
- GetEvent(ctx context.Context, origin, s spec.ServerName, eventID string) (res gomatrixserverlib.Transaction, err error)
-
- GetEventAuth(ctx context.Context, origin, s spec.ServerName, roomVersion gomatrixserverlib.RoomVersion, roomID, eventID string) (res fclient.RespEventAuth, err error)
- GetUserDevices(ctx context.Context, origin, s spec.ServerName, userID string) (fclient.RespUserDevices, error)
- ClaimKeys(ctx context.Context, origin, s spec.ServerName, oneTimeKeys map[string]map[string]string) (fclient.RespClaimKeys, error)
- QueryKeys(ctx context.Context, origin, s spec.ServerName, keys map[string][]string) (fclient.RespQueryKeys, error)
- Backfill(ctx context.Context, origin, s spec.ServerName, roomID string, limit int, eventIDs []string) (res gomatrixserverlib.Transaction, err error)
- MSC2836EventRelationships(ctx context.Context, origin, dst spec.ServerName, r fclient.MSC2836EventRelationshipsRequest, roomVersion gomatrixserverlib.RoomVersion) (res fclient.MSC2836EventRelationshipsResponse, err error)
- MSC2946Spaces(ctx context.Context, origin, dst spec.ServerName, roomID string, suggestedOnly bool) (res fclient.MSC2946SpacesResponse, err error)
-
- ExchangeThirdPartyInvite(ctx context.Context, origin, s spec.ServerName, builder gomatrixserverlib.EventBuilder) (err error)
- LookupState(ctx context.Context, origin, s spec.ServerName, roomID string, eventID string, roomVersion gomatrixserverlib.RoomVersion) (res fclient.RespState, err error)
- LookupStateIDs(ctx context.Context, origin, s spec.ServerName, roomID string, eventID string) (res fclient.RespStateIDs, err error)
- LookupMissingEvents(ctx context.Context, origin, s spec.ServerName, roomID string, missing fclient.MissingEvents, roomVersion gomatrixserverlib.RoomVersion) (res fclient.RespMissingEvents, err error)
-}
-
-type P2PFederationClient interface {
- P2PSendTransactionToRelay(ctx context.Context, u spec.UserID, t gomatrixserverlib.Transaction, forwardingServer spec.ServerName) (res fclient.EmptyResp, err error)
- P2PGetTransactionFromRelay(ctx context.Context, u spec.UserID, prev fclient.RelayEntry, relayServer spec.ServerName) (res fclient.RespGetRelayTransaction, err error)
-}
-
// FederationClientError is returned from FederationClient methods in the event of a problem.
type FederationClientError struct {
Err string
diff --git a/federationapi/federationapi.go b/federationapi/federationapi.go
index c64fa550..14448383 100644
--- a/federationapi/federationapi.go
+++ b/federationapi/federationapi.go
@@ -49,7 +49,7 @@ func AddPublicRoutes(
dendriteConfig *config.Dendrite,
natsInstance *jetstream.NATSInstance,
userAPI userapi.FederationUserAPI,
- federation *fclient.FederationClient,
+ federation fclient.FederationClient,
keyRing gomatrixserverlib.JSONVerifier,
rsAPI roomserverAPI.FederationRoomserverAPI,
fedAPI federationAPI.FederationInternalAPI,
@@ -98,7 +98,7 @@ func NewInternalAPI(
dendriteCfg *config.Dendrite,
cm sqlutil.Connections,
natsInstance *jetstream.NATSInstance,
- federation api.FederationClient,
+ federation fclient.FederationClient,
rsAPI roomserverAPI.FederationRoomserverAPI,
caches *caching.Caches,
keyRing *gomatrixserverlib.KeyRing,
diff --git a/federationapi/federationapi_keys_test.go b/federationapi/federationapi_keys_test.go
index 50691334..9dda389e 100644
--- a/federationapi/federationapi_keys_test.go
+++ b/federationapi/federationapi_keys_test.go
@@ -29,7 +29,7 @@ type server struct {
name spec.ServerName // server name
validity time.Duration // key validity duration from now
config *config.FederationAPI // skeleton config, from TestMain
- fedclient *fclient.FederationClient // uses MockRoundTripper
+ fedclient fclient.FederationClient // uses MockRoundTripper
cache *caching.Caches // server-specific cache
api api.FederationInternalAPI // server-specific server key API
}
diff --git a/federationapi/federationapi_test.go b/federationapi/federationapi_test.go
index 70ad2e28..ca144491 100644
--- a/federationapi/federationapi_test.go
+++ b/federationapi/federationapi_test.go
@@ -55,7 +55,7 @@ func (f *fedRoomserverAPI) QueryRoomsForUser(ctx context.Context, req *rsapi.Que
// TODO: This struct isn't generic, only works for TestFederationAPIJoinThenKeyUpdate
type fedClient struct {
fedClientMutex sync.Mutex
- api.FederationClient
+ fclient.FederationClient
allowJoins []*test.Room
keys map[spec.ServerName]struct {
key ed25519.PrivateKey
diff --git a/federationapi/internal/api.go b/federationapi/internal/api.go
index 529cf777..aa501f63 100644
--- a/federationapi/internal/api.go
+++ b/federationapi/internal/api.go
@@ -17,6 +17,7 @@ import (
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/gomatrix"
"github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
"github.com/sirupsen/logrus"
)
@@ -27,7 +28,7 @@ type FederationInternalAPI struct {
cfg *config.FederationAPI
statistics *statistics.Statistics
rsAPI roomserverAPI.FederationRoomserverAPI
- federation api.FederationClient
+ federation fclient.FederationClient
keyRing *gomatrixserverlib.KeyRing
queues *queue.OutgoingQueues
joins sync.Map // joins currently in progress
@@ -36,7 +37,7 @@ type FederationInternalAPI struct {
func NewFederationInternalAPI(
db storage.Database, cfg *config.FederationAPI,
rsAPI roomserverAPI.FederationRoomserverAPI,
- federation api.FederationClient,
+ federation fclient.FederationClient,
statistics *statistics.Statistics,
caches *caching.Caches,
queues *queue.OutgoingQueues,
diff --git a/federationapi/internal/perform.go b/federationapi/internal/perform.go
index c0e0ba14..c73b69d9 100644
--- a/federationapi/internal/perform.go
+++ b/federationapi/internal/perform.go
@@ -773,7 +773,7 @@ func setDefaultRoomVersionFromJoinEvent(
// FederatedAuthProvider is an auth chain provider which fetches events from the server provided
func federatedAuthProvider(
- ctx context.Context, federation api.FederationClient,
+ ctx context.Context, federation fclient.FederationClient,
keyRing gomatrixserverlib.JSONVerifier, origin, server spec.ServerName,
) gomatrixserverlib.AuthChainProvider {
// A list of events that we have retried, if they were not included in
diff --git a/federationapi/internal/perform_test.go b/federationapi/internal/perform_test.go
index 4f836242..2f61235a 100644
--- a/federationapi/internal/perform_test.go
+++ b/federationapi/internal/perform_test.go
@@ -30,7 +30,7 @@ import (
)
type testFedClient struct {
- api.FederationClient
+ fclient.FederationClient
queryKeysCalled bool
claimKeysCalled bool
shouldFail bool
diff --git a/federationapi/queue/destinationqueue.go b/federationapi/queue/destinationqueue.go
index c136fe75..c00659ff 100644
--- a/federationapi/queue/destinationqueue.go
+++ b/federationapi/queue/destinationqueue.go
@@ -28,7 +28,6 @@ import (
"github.com/sirupsen/logrus"
"go.uber.org/atomic"
- fedapi "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/federationapi/statistics"
"github.com/matrix-org/dendrite/federationapi/storage"
"github.com/matrix-org/dendrite/federationapi/storage/shared/receipt"
@@ -54,7 +53,7 @@ type destinationQueue struct {
process *process.ProcessContext
signing map[spec.ServerName]*fclient.SigningIdentity
rsAPI api.FederationRoomserverAPI
- client fedapi.FederationClient // federation client
+ client fclient.FederationClient // federation client
origin spec.ServerName // origin of requests
destination spec.ServerName // destination of requests
running atomic.Bool // is the queue worker running?
diff --git a/federationapi/queue/queue.go b/federationapi/queue/queue.go
index 860446a0..a482e43e 100644
--- a/federationapi/queue/queue.go
+++ b/federationapi/queue/queue.go
@@ -29,7 +29,6 @@ import (
log "github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
- fedapi "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/federationapi/statistics"
"github.com/matrix-org/dendrite/federationapi/storage"
"github.com/matrix-org/dendrite/federationapi/storage/shared/receipt"
@@ -45,7 +44,7 @@ type OutgoingQueues struct {
disabled bool
rsAPI api.FederationRoomserverAPI
origin spec.ServerName
- client fedapi.FederationClient
+ client fclient.FederationClient
statistics *statistics.Statistics
signing map[spec.ServerName]*fclient.SigningIdentity
queuesMutex sync.Mutex // protects the below
@@ -89,7 +88,7 @@ func NewOutgoingQueues(
process *process.ProcessContext,
disabled bool,
origin spec.ServerName,
- client fedapi.FederationClient,
+ client fclient.FederationClient,
rsAPI api.FederationRoomserverAPI,
statistics *statistics.Statistics,
signing []*fclient.SigningIdentity,
diff --git a/federationapi/queue/queue_test.go b/federationapi/queue/queue_test.go
index 7e71d69d..f42b56e5 100644
--- a/federationapi/queue/queue_test.go
+++ b/federationapi/queue/queue_test.go
@@ -32,7 +32,6 @@ import (
"github.com/matrix-org/gomatrixserverlib"
"github.com/stretchr/testify/assert"
- "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/federationapi/statistics"
"github.com/matrix-org/dendrite/federationapi/storage"
rsapi "github.com/matrix-org/dendrite/roomserver/api"
@@ -75,7 +74,7 @@ func (r *stubFederationRoomServerAPI) QueryServerBannedFromRoom(ctx context.Cont
}
type stubFederationClient struct {
- api.FederationClient
+ fclient.FederationClient
shouldTxSucceed bool
shouldTxRelaySucceed bool
txCount atomic.Uint32
diff --git a/federationapi/routing/query.go b/federationapi/routing/query.go
index 6b1c371e..61efd73f 100644
--- a/federationapi/routing/query.go
+++ b/federationapi/routing/query.go
@@ -31,7 +31,7 @@ import (
// RoomAliasToID converts the queried alias into a room ID and returns it
func RoomAliasToID(
httpReq *http.Request,
- federation federationAPI.FederationClient,
+ federation fclient.FederationClient,
cfg *config.FederationAPI,
rsAPI roomserverAPI.FederationRoomserverAPI,
senderAPI federationAPI.FederationInternalAPI,
diff --git a/federationapi/routing/query_test.go b/federationapi/routing/query_test.go
index 1004fe1e..e7094e19 100644
--- a/federationapi/routing/query_test.go
+++ b/federationapi/routing/query_test.go
@@ -25,7 +25,6 @@ import (
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/cmd/dendrite-demo-yggdrasil/signing"
fedAPI "github.com/matrix-org/dendrite/federationapi"
- fedclient "github.com/matrix-org/dendrite/federationapi/api"
fedInternal "github.com/matrix-org/dendrite/federationapi/internal"
"github.com/matrix-org/dendrite/federationapi/routing"
"github.com/matrix-org/dendrite/internal/caching"
@@ -42,7 +41,7 @@ import (
)
type fakeFedClient struct {
- fedclient.FederationClient
+ fclient.FederationClient
}
func (f *fakeFedClient) LookupRoomAlias(ctx context.Context, origin, s spec.ServerName, roomAlias string) (res fclient.RespDirectory, err error) {
diff --git a/federationapi/routing/routing.go b/federationapi/routing/routing.go
index 41af5e7d..c82912c9 100644
--- a/federationapi/routing/routing.go
+++ b/federationapi/routing/routing.go
@@ -61,7 +61,7 @@ func Setup(
rsAPI roomserverAPI.FederationRoomserverAPI,
fsAPI *fedInternal.FederationInternalAPI,
keys gomatrixserverlib.JSONVerifier,
- federation federationAPI.FederationClient,
+ federation fclient.FederationClient,
userAPI userapi.FederationUserAPI,
mscCfg *config.MSCs,
servers federationAPI.ServersInRoomProvider,
diff --git a/federationapi/routing/send.go b/federationapi/routing/send.go
index deefe5f1..2e674f98 100644
--- a/federationapi/routing/send.go
+++ b/federationapi/routing/send.go
@@ -62,7 +62,7 @@ func Send(
rsAPI api.FederationRoomserverAPI,
keyAPI userAPI.FederationUserAPI,
keys gomatrixserverlib.JSONVerifier,
- federation federationAPI.FederationClient,
+ federation fclient.FederationClient,
mu *internal.MutexByRoom,
servers federationAPI.ServersInRoomProvider,
producer *producers.SyncAPIProducer,
diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go
index 31f29fd3..aaee939e 100644
--- a/federationapi/routing/threepid.go
+++ b/federationapi/routing/threepid.go
@@ -23,7 +23,6 @@ import (
"github.com/matrix-org/dendrite/clientapi/httputil"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
- federationAPI "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/setup/config"
userapi "github.com/matrix-org/dendrite/userapi/api"
@@ -60,7 +59,7 @@ var (
func CreateInvitesFrom3PIDInvites(
req *http.Request, rsAPI api.FederationRoomserverAPI,
cfg *config.FederationAPI,
- federation federationAPI.FederationClient,
+ federation fclient.FederationClient,
userAPI userapi.FederationUserAPI,
) util.JSONResponse {
var body invites
@@ -120,7 +119,7 @@ func ExchangeThirdPartyInvite(
roomID string,
rsAPI api.FederationRoomserverAPI,
cfg *config.FederationAPI,
- federation federationAPI.FederationClient,
+ federation fclient.FederationClient,
) util.JSONResponse {
var builder gomatrixserverlib.EventBuilder
if err := json.Unmarshal(request.Content(), &builder); err != nil {
@@ -237,7 +236,7 @@ func ExchangeThirdPartyInvite(
func createInviteFrom3PIDInvite(
ctx context.Context, rsAPI api.FederationRoomserverAPI,
cfg *config.FederationAPI,
- inv invite, federation federationAPI.FederationClient,
+ inv invite, federation fclient.FederationClient,
userAPI userapi.FederationUserAPI,
) (*gomatrixserverlib.Event, error) {
verReq := api.QueryRoomVersionForRoomRequest{RoomID: inv.RoomID}
@@ -364,7 +363,7 @@ func buildMembershipEvent(
// them responded with an error.
func sendToRemoteServer(
ctx context.Context, inv invite,
- federation federationAPI.FederationClient, cfg *config.FederationAPI,
+ federation fclient.FederationClient, cfg *config.FederationAPI,
builder gomatrixserverlib.EventBuilder,
) (err error) {
remoteServers := make([]spec.ServerName, 2)
diff --git a/go.mod b/go.mod
index 75320aa6..8f04ffbc 100644
--- a/go.mod
+++ b/go.mod
@@ -22,7 +22,7 @@ require (
github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530
- github.com/matrix-org/gomatrixserverlib v0.0.0-20230424084733-070fb6767374
+ github.com/matrix-org/gomatrixserverlib v0.0.0-20230424155704-8daeaebaa0bc
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66
github.com/mattn/go-sqlite3 v1.14.16
diff --git a/go.sum b/go.sum
index 71950c1b..374573c8 100644
--- a/go.sum
+++ b/go.sum
@@ -321,32 +321,8 @@ github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw
github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91/go.mod h1:e+cg2q7C7yE5QnAXgzo512tgFh1RbQLC0+jozuegKgo=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530 h1:kHKxCOLcHH8r4Fzarl4+Y3K5hjothkVW5z7T1dUM11U=
github.com/matrix-org/gomatrix v0.0.0-20220926102614-ceba4d9f7530/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230414140439-3cf4cd94d75f h1:sULN+zkwjt9bBy3dy5W98B6J/Pd4xOiF6yjWOBRRKmw=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230414140439-3cf4cd94d75f/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418093913-f0ab3b996ed5 h1:WVjB9i6+0WvX/pc4jDQPYVWIf/SyYf0Aa9hhiQBdLq8=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418093913-f0ab3b996ed5/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418110303-b59eb925da4a h1:84t3ixdKTJOzgmr8+KesjPY9G9g1LX0fz5zD6E4ybHA=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418110303-b59eb925da4a/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418132954-2113ec20fc8e h1:nLZjU+z/W2n48/9mlCjx+QWo3Q6z777RrLi6Id2CzmM=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230418132954-2113ec20fc8e/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230419135026-7f3c8ee774a0 h1:u+1vK+Sj2gL8IWgaaSF4WM38iL/Cx7jf6Q/aa1g0Icc=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230419135026-7f3c8ee774a0/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420162839-554da317ffc2 h1:4ie9gE3sPfR8ecyRCpCUbWXnvgxB7fWj7O/B5NS0orc=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420162839-554da317ffc2/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420165305-c51ffd14d28d h1:pShTdTsNhtkY9cv0+tbFBvLnQKUeZ23ismYMc9xP9aE=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420165305-c51ffd14d28d/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420172450-7ea8ead4a832 h1:xEUPCS8+BEJ9+JEazxkQS1+YnWyFAsHoIMp5ijA7NAY=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230420172450-7ea8ead4a832/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421103805-98f1fbf26443 h1:UxYdP/B+wN67pOWpvzlNeASMn9K1reF/bPHFo1wpqXQ=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421103805-98f1fbf26443/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421124419-d1e66b713adc h1:MBbfplk/2QE6i3ylkSVnn3eZ6DUlmftn6aF1fyBwiF4=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421124419-d1e66b713adc/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421161959-65453e03e060 h1:LsP+VWtl+jKfvramnoL9HK2A+n1RLpIXpHsWyWLrlcQ=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421161959-65453e03e060/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421163103-6550f4f6d63a h1:aj2f5OtVYMmO2UWx622B/KRNGtAWdXO2q8AYGxw8+6M=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230421163103-6550f4f6d63a/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230424084733-070fb6767374 h1:ZZPQN31NKW1Rbpvmz2D6QF6l70vmQAQMEs0p+wjmS2E=
-github.com/matrix-org/gomatrixserverlib v0.0.0-20230424084733-070fb6767374/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
+github.com/matrix-org/gomatrixserverlib v0.0.0-20230424155704-8daeaebaa0bc h1:F73iHhpTZxWVO6qbyGZxd7Ch44v1gK6xNQZ7QVos/Es=
+github.com/matrix-org/gomatrixserverlib v0.0.0-20230424155704-8daeaebaa0bc/go.mod h1:7HTbSZe+CIdmeqVyFMekwD5dFU8khWQyngKATvd12FU=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a h1:awrPDf9LEFySxTLKYBMCiObelNx/cBuv/wzllvCCH3A=
github.com/matrix-org/pinecone v0.11.1-0.20230210171230-8c3b24f2649a/go.mod h1:HchJX9oKMXaT2xYFs0Ha/6Zs06mxLU8k6F1ODnrGkeQ=
github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y=
diff --git a/relayapi/internal/api.go b/relayapi/internal/api.go
index 55e86aef..603309cf 100644
--- a/relayapi/internal/api.go
+++ b/relayapi/internal/api.go
@@ -17,17 +17,17 @@ package internal
import (
"sync"
- fedAPI "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/federationapi/producers"
"github.com/matrix-org/dendrite/relayapi/storage"
rsAPI "github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/gomatrixserverlib/fclient"
"github.com/matrix-org/gomatrixserverlib/spec"
)
type RelayInternalAPI struct {
db storage.Database
- fedClient fedAPI.FederationClient
+ fedClient fclient.FederationClient
rsAPI rsAPI.RoomserverInternalAPI
keyRing *gomatrixserverlib.KeyRing
producer *producers.SyncAPIProducer
@@ -39,7 +39,7 @@ type RelayInternalAPI struct {
func NewRelayInternalAPI(
db storage.Database,
- fedClient fedAPI.FederationClient,
+ fedClient fclient.FederationClient,
rsAPI rsAPI.RoomserverInternalAPI,
keyRing *gomatrixserverlib.KeyRing,
producer *producers.SyncAPIProducer,
diff --git a/relayapi/internal/perform_test.go b/relayapi/internal/perform_test.go
index 111fb46b..f97c5aa9 100644
--- a/relayapi/internal/perform_test.go
+++ b/relayapi/internal/perform_test.go
@@ -19,7 +19,6 @@ import (
"fmt"
"testing"
- fedAPI "github.com/matrix-org/dendrite/federationapi/api"
"github.com/matrix-org/dendrite/internal/sqlutil"
"github.com/matrix-org/dendrite/relayapi/storage/shared"
"github.com/matrix-org/dendrite/test"
@@ -30,7 +29,7 @@ import (
)
type testFedClient struct {
- fedAPI.FederationClient
+ fclient.FederationClient
shouldFail bool
queryCount uint
queueDepth uint
diff --git a/relayapi/relayapi.go b/relayapi/relayapi.go
index bae6b0cf..acabb4b2 100644
--- a/relayapi/relayapi.go
+++ b/relayapi/relayapi.go
@@ -54,7 +54,7 @@ func AddPublicRoutes(
func NewRelayInternalAPI(
dendriteCfg *config.Dendrite,
cm sqlutil.Connections,
- fedClient *fclient.FederationClient,
+ fedClient fclient.FederationClient,
rsAPI rsAPI.RoomserverInternalAPI,
keyRing *gomatrixserverlib.KeyRing,
producer *producers.SyncAPIProducer,
diff --git a/setup/base/base.go b/setup/base/base.go
index d6c35010..ea342054 100644
--- a/setup/base/base.go
+++ b/setup/base/base.go
@@ -74,7 +74,7 @@ func CreateClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) *fclient.Cli
// CreateFederationClient creates a new federation client. Should only be called
// once per component.
-func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) *fclient.FederationClient {
+func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) fclient.FederationClient {
identities := cfg.Global.SigningIdentities()
if cfg.Global.DisableFederation {
return fclient.NewFederationClient(
@@ -85,6 +85,7 @@ func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) *f
fclient.WithTimeout(time.Minute * 5),
fclient.WithSkipVerify(cfg.FederationAPI.DisableTLSValidation),
fclient.WithKeepAlives(!cfg.FederationAPI.DisableHTTPKeepalives),
+ fclient.WithUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString())),
}
if cfg.Global.DNSCache.Enabled {
opts = append(opts, fclient.WithDNSCache(dnsCache))
@@ -92,7 +93,6 @@ func CreateFederationClient(cfg *config.Dendrite, dnsCache *fclient.DNSCache) *f
client := fclient.NewFederationClient(
identities, opts...,
)
- client.SetUserAgent(fmt.Sprintf("Dendrite/%s", internal.VersionString()))
return client
}
diff --git a/setup/monolith.go b/setup/monolith.go
index e5af6985..d9893042 100644
--- a/setup/monolith.go
+++ b/setup/monolith.go
@@ -43,7 +43,7 @@ type Monolith struct {
Config *config.Dendrite
KeyRing *gomatrixserverlib.KeyRing
Client *fclient.Client
- FedClient *fclient.FederationClient
+ FedClient fclient.FederationClient
AppserviceAPI appserviceAPI.AppServiceInternalAPI
FederationAPI federationAPI.FederationInternalAPI
diff --git a/userapi/internal/device_list_update_test.go b/userapi/internal/device_list_update_test.go
index 3a269801..4d075e52 100644
--- a/userapi/internal/device_list_update_test.go
+++ b/userapi/internal/device_list_update_test.go
@@ -137,7 +137,7 @@ func (t *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
return t.fn(req)
}
-func newFedClient(tripper func(*http.Request) (*http.Response, error)) *fclient.FederationClient {
+func newFedClient(tripper func(*http.Request) (*http.Response, error)) fclient.FederationClient {
_, pkey, _ := ed25519.GenerateKey(nil)
fedClient := fclient.NewFederationClient(
[]*fclient.SigningIdentity{
@@ -147,8 +147,6 @@ func newFedClient(tripper func(*http.Request) (*http.Response, error)) *fclient.
PrivateKey: pkey,
},
},
- )
- fedClient.Client = *fclient.NewClient(
fclient.WithTransport(&roundTripper{tripper}),
)
return fedClient