diff --git a/clientapi/clientapi_test.go b/clientapi/clientapi_test.go index ad2d4ad48..289c4dcc8 100644 --- a/clientapi/clientapi_test.go +++ b/clientapi/clientapi_test.go @@ -32,7 +32,6 @@ import ( "github.com/element-hq/dendrite/test/testrig" "github.com/element-hq/dendrite/userapi" uapi "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" @@ -1074,7 +1073,7 @@ func TestTurnserver(t *testing.T) { if !tc.wantEmptyResponse { assert.NotEqual(t, "{}", rec.Body.String()) - resp := gomatrix.RespTurnServer{} + resp := mautrix.RespTurnServer{} err := json.NewDecoder(rec.Body).Decode(&resp) assert.NoError(t, err) diff --git a/clientapi/routing/joinroom.go b/clientapi/routing/joinroom.go index 275d356a3..d29e77a43 100644 --- a/clientapi/routing/joinroom.go +++ b/clientapi/routing/joinroom.go @@ -16,9 +16,9 @@ import ( "github.com/element-hq/dendrite/internal/eventutil" roomserverAPI "github.com/element-hq/dendrite/roomserver/api" "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" + "maunium.net/go/mautrix" ) func JoinRoomByIDOrAlias( @@ -107,9 +107,13 @@ func JoinRoomByIDOrAlias( Code: http.StatusForbidden, JSON: jsonErr, } - case *gomatrix.HTTPError: // this ensures we proxy responses over federation to the client + case *mautrix.HTTPError: // this ensures we proxy responses over federation to the client + code := http.StatusInternalServerError + if e.Response != nil { + code = e.Response.StatusCode + } response = util.JSONResponse{ - Code: e.Code, + Code: code, JSON: json.RawMessage(e.Message), } case eventutil.ErrRoomNoExists: diff --git a/clientapi/routing/peekroom.go b/clientapi/routing/peekroom.go index 9b6699b09..11a60c6f4 100644 --- a/clientapi/routing/peekroom.go +++ b/clientapi/routing/peekroom.go @@ -11,10 +11,10 @@ import ( roomserverAPI "github.com/element-hq/dendrite/roomserver/api" "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" "github.com/sirupsen/logrus" + "maunium.net/go/mautrix" ) func PeekRoomByIDOrAlias( @@ -58,9 +58,13 @@ func PeekRoomByIDOrAlias( Code: http.StatusForbidden, JSON: spec.Forbidden(e.Error()), } - case *gomatrix.HTTPError: + case *mautrix.HTTPError: + code := http.StatusInternalServerError + if e.Response != nil { + code = e.Response.StatusCode + } return util.JSONResponse{ - Code: e.Code, + Code: code, JSON: json.RawMessage(e.Message), } case nil: diff --git a/clientapi/routing/profile.go b/clientapi/routing/profile.go index b75d38a62..b47a017ad 100644 --- a/clientapi/routing/profile.go +++ b/clientapi/routing/profile.go @@ -24,8 +24,8 @@ import ( "github.com/element-hq/dendrite/roomserver/types" "github.com/element-hq/dendrite/setup/config" userapi "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/util" + "maunium.net/go/mautrix" ) // GetProfile implements GET /profile/{userID} @@ -320,8 +320,8 @@ func getProfile( if !cfg.Matrix.IsLocalServerName(domain) { profile, fedErr := federation.LookupProfile(ctx, cfg.Matrix.ServerName, domain, userID, "") if fedErr != nil { - if x, ok := fedErr.(gomatrix.HTTPError); ok { - if x.Code == http.StatusNotFound { + if x, ok := fedErr.(mautrix.HTTPError); ok { + if x.IsStatus(http.StatusNotFound) { return nil, appserviceAPI.ErrProfileNotExists } } diff --git a/clientapi/routing/room_tagging.go b/clientapi/routing/room_tagging.go index 191cf1331..c86655e56 100644 --- a/clientapi/routing/room_tagging.go +++ b/clientapi/routing/room_tagging.go @@ -13,9 +13,9 @@ import ( "github.com/element-hq/dendrite/clientapi/httputil" "github.com/element-hq/dendrite/clientapi/producers" "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" + "maunium.net/go/mautrix/event" ) // GetTags implements GET /_matrix/client/r0/user/{userID}/rooms/{roomID}/tags @@ -70,7 +70,7 @@ func PutTag( } } - var properties gomatrix.TagProperties + var properties event.Tag if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil { return *reqErr } @@ -85,7 +85,7 @@ func PutTag( } if tagContent.Tags == nil { - tagContent.Tags = make(map[string]gomatrix.TagProperties) + tagContent.Tags = make(event.Tags) } tagContent.Tags[tag] = properties @@ -164,7 +164,7 @@ func obtainSavedTags( userID string, roomID string, userAPI api.ClientUserAPI, -) (tags gomatrix.TagContent, err error) { +) (tags event.TagEventContent, err error) { dataReq := api.QueryAccountDataRequest{ UserID: userID, RoomID: roomID, @@ -191,7 +191,7 @@ func saveTagData( userID string, roomID string, userAPI api.ClientUserAPI, - Tag gomatrix.TagContent, + Tag event.TagEventContent, ) error { newTagData, err := json.Marshal(Tag) if err != nil { diff --git a/clientapi/routing/server_notices.go b/clientapi/routing/server_notices.go index 2e38c2083..837f5e834 100644 --- a/clientapi/routing/server_notices.go +++ b/clientapi/routing/server_notices.go @@ -13,12 +13,12 @@ import ( "net/http" "time" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/tokens" "github.com/matrix-org/util" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" + "maunium.net/go/mautrix/event" "github.com/element-hq/dendrite/roomserver/types" @@ -169,9 +169,9 @@ func SendServerNotice( roomID = data.RoomID // tag the room, so we can later check if the user tries to reject an invite - serverAlertTag := gomatrix.TagContent{Tags: map[string]gomatrix.TagProperties{ + serverAlertTag := event.TagEventContent{Tags: event.Tags{ "m.server_notice": { - Order: 1.0, + Order: json.Number("1"), }, }} if err = saveTagData(req, r.UserID, roomID, userAPI, serverAlertTag); err != nil { diff --git a/clientapi/routing/userdirectory.go b/clientapi/routing/userdirectory.go index c46fc5a2a..664aad27d 100644 --- a/clientapi/routing/userdirectory.go +++ b/clientapi/routing/userdirectory.go @@ -16,11 +16,11 @@ import ( "github.com/element-hq/dendrite/clientapi/auth/authtypes" "github.com/element-hq/dendrite/roomserver/api" userapi "github.com/element-hq/dendrite/userapi/api" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" + "maunium.net/go/mautrix" ) type UserDirectoryResponse struct { @@ -102,8 +102,8 @@ knownUsersLoop: // TODO: We should probably cache/store this fedProfile, fedErr := federation.LookupProfile(ctx, localServerName, serverName, userID, "") if fedErr != nil { - if x, ok := fedErr.(gomatrix.HTTPError); ok { - if x.Code == http.StatusNotFound { + if x, ok := fedErr.(mautrix.HTTPError); ok { + if x.IsStatus(http.StatusNotFound) { continue } } diff --git a/clientapi/routing/voip.go b/clientapi/routing/voip.go index 24f68029a..b0b5a133c 100644 --- a/clientapi/routing/voip.go +++ b/clientapi/routing/voip.go @@ -14,8 +14,8 @@ import ( "net/http" "time" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/util" + "maunium.net/go/mautrix" "github.com/element-hq/dendrite/setup/config" "github.com/element-hq/dendrite/userapi/api" @@ -39,7 +39,7 @@ func RequestTurnServer(req *http.Request, device *api.Device, cfg *config.Client // Duration checked at startup, err not possible duration, _ := time.ParseDuration(turnConfig.UserLifetime) - resp := gomatrix.RespTurnServer{ + resp := mautrix.RespTurnServer{ URIs: turnConfig.URIs, TTL: int(duration.Seconds()), } diff --git a/cmd/dendrite-upgrade-tests/tests.go b/cmd/dendrite-upgrade-tests/tests.go index 692ab34ef..a0ce9d07f 100644 --- a/cmd/dendrite-upgrade-tests/tests.go +++ b/cmd/dendrite-upgrade-tests/tests.go @@ -1,15 +1,18 @@ package main import ( + "context" "fmt" "log" "strings" "time" "github.com/Masterminds/semver/v3" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/spec" + "maunium.net/go/mautrix" + "maunium.net/go/mautrix/event" + "maunium.net/go/mautrix/id" ) const userPassword = "this_is_a_long_password" @@ -17,7 +20,7 @@ const userPassword = "this_is_a_long_password" type user struct { userID string localpart string - client *gomatrix.Client + client *mautrix.Client } // runTests performs the following operations: @@ -36,40 +39,40 @@ func runTests(baseURL string, v *semver.Version) error { }, } for i, u := range users { - client, err := gomatrix.NewClient(baseURL, "", "") + client, err := mautrix.NewClient(baseURL, "", "") if err != nil { return err } - resp, err := client.RegisterDummy(&gomatrix.ReqRegister{ + resp, err := client.RegisterDummy(&mautrix.ReqRegister{ Username: strings.ToLower(u.localpart), Password: userPassword, }) if err != nil { return fmt.Errorf("failed to register %s: %s", u.localpart, err) } - client, err = gomatrix.NewClient(baseURL, resp.UserID, resp.AccessToken) + client, err = mautrix.NewClient(baseURL, resp.UserID, resp.AccessToken) if err != nil { return err } users[i].client = client - users[i].userID = resp.UserID + users[i].userID = string(resp.UserID) } // create DM room, join it and exchange messages - createRoomResp, err := users[0].client.CreateRoom(&gomatrix.ReqCreateRoom{ + createRoomResp, err := users[0].client.CreateRoom(&mautrix.ReqCreateRoom{ Preset: spec.PresetTrustedPrivateChat, - Invite: []string{users[1].userID}, + Invite: []id.UserID{id.UserID(users[1].userID)}, IsDirect: true, }) if err != nil { return fmt.Errorf("failed to create DM room: %s", err) } dmRoomID := createRoomResp.RoomID - if _, err = users[1].client.JoinRoom(dmRoomID, "", nil); err != nil { + if _, err = users[1].client.JoinRoom(dmRoomID.String(), "", nil); err != nil { return fmt.Errorf("failed to join DM room: %s", err) } msgs := []struct { - client *gomatrix.Client + client *mautrix.Client text string }{ { @@ -85,9 +88,9 @@ func runTests(baseURL string, v *semver.Version) error { client: users[1].client, text: "4: " + branchName, }, } - wantEventIDs := make(map[string]struct{}, 8) + wantEventIDs := make(map[id.EventID]struct{}, 8) for _, msg := range msgs { - var resp *gomatrix.RespSendEvent + var resp *mautrix.RespSendEvent resp, err = msg.client.SendText(dmRoomID, msg.text) if err != nil { return fmt.Errorf("failed to send text in dm room: %s", err) @@ -96,8 +99,8 @@ func runTests(baseURL string, v *semver.Version) error { } // attempt to create/join the shared public room - publicRoomID := "" - createRoomResp, err = users[0].client.CreateRoom(&gomatrix.ReqCreateRoom{ + var publicRoomID id.RoomID + createRoomResp, err = users[0].client.CreateRoom(&mautrix.ReqCreateRoom{ RoomAliasName: "global", Preset: spec.PresetPublicChat, }) @@ -115,7 +118,7 @@ func runTests(baseURL string, v *semver.Version) error { } else { publicRoomID = createRoomResp.RoomID } - if _, err = users[1].client.JoinRoom(publicRoomID, "", nil); err != nil { + if _, err = users[1].client.JoinRoom(publicRoomID.String(), "", nil); err != nil { return fmt.Errorf("bob failed to join public room: %s", err) } // send messages @@ -138,13 +141,13 @@ func runTests(baseURL string, v *semver.Version) error { return default: } - syncResp, err := syncClient.SyncRequest(1000, since, "1", false, "") + syncResp, err := syncClient.SyncRequest(1000, since, "1", false, "", context.Background()) if err != nil { continue } for _, room := range syncResp.Rooms.Join { for _, ev := range room.Timeline.Events { - if ev.Type != "m.room.message" { + if ev.Type != event.EventMessage { continue } delete(wantEventIDs, ev.ID) @@ -170,9 +173,9 @@ func runTests(baseURL string, v *semver.Version) error { func verifyTestsRan(baseURL string, versions []*semver.Version) error { log.Println("Verifying tests....") // check we can login as all users - var resp *gomatrix.RespLogin + var resp *mautrix.RespLogin for _, version := range versions { - client, err := gomatrix.NewClient(baseURL, "", "") + client, err := mautrix.NewClient(baseURL, "", "") if err != nil { return err } @@ -182,10 +185,10 @@ func verifyTestsRan(baseURL string, versions []*semver.Version) error { "bob" + branchName, } for _, userLocalpart := range userLocalparts { - resp, err = client.Login(&gomatrix.ReqLogin{ - Type: "m.login.password", - User: strings.ToLower(userLocalpart), - Password: userPassword, + resp, err = client.Login(&mautrix.ReqLogin{ + Type: mautrix.AuthTypePassword, + Identifier: mautrix.UserIdentifier{Type: mautrix.IdentifierTypeUser, User: strings.ToLower(userLocalpart)}, + Password: userPassword, }) if err != nil { return fmt.Errorf("failed to login as %s: %s", userLocalpart, err) @@ -196,19 +199,19 @@ func verifyTestsRan(baseURL string, versions []*semver.Version) error { } } log.Println(" accounts exist: OK") - client, err := gomatrix.NewClient(baseURL, resp.UserID, resp.AccessToken) + client, err := mautrix.NewClient(baseURL, resp.UserID, resp.AccessToken) if err != nil { return err } - _, domain, err := gomatrixserverlib.SplitID('@', client.UserID) + _, domain, err := gomatrixserverlib.SplitID('@', string(client.UserID)) if err != nil { return err } - u := client.BuildURL("directory", "room", fmt.Sprintf("#global:%s", domain)) + u := client.BuildClientURL("v3", "directory", "room", fmt.Sprintf("#global:%s", domain)) r := struct { RoomID string `json:"room_id"` }{} - err = client.MakeRequest("GET", u, nil, &r) + _, err = client.MakeRequest("GET", u, nil, &r) if err != nil { return fmt.Errorf("failed to /directory: %s", err) } @@ -217,14 +220,14 @@ func verifyTestsRan(baseURL string, versions []*semver.Version) error { } log.Println(" public room exists: OK") - history, err := client.Messages(r.RoomID, client.Store.LoadNextBatch(client.UserID), "", 'b', 100) + history, err := client.Messages(id.RoomID(r.RoomID), client.Store.LoadNextBatch(client.UserID), "", mautrix.DirectionBackward, nil, 100) if err != nil { return fmt.Errorf("failed to get /messages: %s", err) } // we expect 4 messages per version msgCount := 0 for _, ev := range history.Chunk { - if ev.Type == "m.room.message" { + if ev.Type == event.EventMessage { msgCount += 1 } } diff --git a/federationapi/api/api.go b/federationapi/api/api.go index 0a4055436..dee53e91b 100644 --- a/federationapi/api/api.go +++ b/federationapi/api/api.go @@ -5,10 +5,10 @@ import ( "fmt" "time" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" + "maunium.net/go/mautrix" "github.com/element-hq/dendrite/federationapi/types" rstypes "github.com/element-hq/dendrite/roomserver/types" @@ -170,7 +170,7 @@ type PerformJoinRequest struct { type PerformJoinResponse struct { JoinedVia spec.ServerName - LastError *gomatrix.HTTPError + LastError *mautrix.HTTPError } type PerformOutboundPeekRequest struct { @@ -180,7 +180,7 @@ type PerformOutboundPeekRequest struct { } type PerformOutboundPeekResponse struct { - LastError *gomatrix.HTTPError + LastError *mautrix.HTTPError } type PerformLeaveRequest struct { diff --git a/federationapi/federationapi_test.go b/federationapi/federationapi_test.go index 3d4faad59..ea44dc133 100644 --- a/federationapi/federationapi_test.go +++ b/federationapi/federationapi_test.go @@ -16,7 +16,6 @@ import ( "github.com/element-hq/dendrite/internal/caching" "github.com/element-hq/dendrite/internal/httputil" "github.com/element-hq/dendrite/internal/sqlutil" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" @@ -24,6 +23,7 @@ import ( "github.com/nats-io/nats.go" "github.com/stretchr/testify/assert" "github.com/tidwall/gjson" + "maunium.net/go/mautrix" "github.com/element-hq/dendrite/federationapi" "github.com/element-hq/dendrite/federationapi/api" @@ -357,13 +357,13 @@ func TestRoomsV3URLEscapeDoNot404(t *testing.T) { t.Errorf("expected an error, got none") continue } - gerr, ok := err.(gomatrix.HTTPError) + gerr, ok := err.(mautrix.HTTPError) if !ok { - t.Errorf("failed to cast response error as gomatrix.HTTPError: %s", err) + t.Errorf("failed to cast response error as mautrix.HTTPError: %s", err) continue } t.Logf("Error: %+v", gerr) - if gerr.Code == 404 { + if gerr.IsStatus(404) { t.Errorf("invite event resulted in a 404") } } diff --git a/federationapi/internal/api.go b/federationapi/internal/api.go index 809cf2046..9c31d66a7 100644 --- a/federationapi/internal/api.go +++ b/federationapi/internal/api.go @@ -15,11 +15,11 @@ import ( "github.com/element-hq/dendrite/internal/caching" roomserverAPI "github.com/element-hq/dendrite/roomserver/api" "github.com/element-hq/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" + "maunium.net/go/mautrix" ) // FederationInternalAPI is an implementation of api.FederationInternalAPI @@ -135,14 +135,18 @@ func failBlacklistableError(err error, stats *statistics.ServerStatistics) (unti if err == nil { return } - mxerr, ok := err.(gomatrix.HTTPError) + mxerr, ok := err.(mautrix.HTTPError) if !ok { return stats.Failure() } - if mxerr.Code == 401 { // invalid signature in X-Matrix header + statusCode := 0 + if mxerr.Response != nil { + statusCode = mxerr.Response.StatusCode + } + if statusCode == 401 { // invalid signature in X-Matrix header return stats.Failure() } - if mxerr.Code >= 500 && mxerr.Code < 600 { // internal server errors + if statusCode >= 500 && statusCode < 600 { // internal server errors return stats.Failure() } return diff --git a/federationapi/internal/perform.go b/federationapi/internal/perform.go index 8797d5d18..bfbc4becb 100644 --- a/federationapi/internal/perform.go +++ b/federationapi/internal/perform.go @@ -6,14 +6,15 @@ import ( "encoding/json" "errors" "fmt" + "net/http" "time" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" "github.com/sirupsen/logrus" + "maunium.net/go/mautrix" "github.com/element-hq/dendrite/federationapi/api" "github.com/element-hq/dendrite/federationapi/consumers" @@ -63,8 +64,9 @@ func (r *FederationInternalAPI) PerformJoin( // Check that a join isn't already in progress for this user/room. j := federatedJoin{request.UserID, request.RoomID} if _, found := r.joins.Load(j); found { - response.LastError = &gomatrix.HTTPError{ - Code: 429, + response.LastError = &mautrix.HTTPError{ + Response: &http.Response{StatusCode: 429}, + WrappedError: errors.New("a federated join to this room is already in progress"), Message: `{ "errcode": "M_LIMIT_EXCEEDED", "error": "There is already a federated join to this room in progress. Please wait for it to finish." @@ -115,14 +117,14 @@ func (r *FederationInternalAPI) PerformJoin( } // If we reach here then we didn't complete a join for some reason. - var httpErr gomatrix.HTTPError + var httpErr mautrix.HTTPError if ok := errors.As(lastErr, &httpErr); ok { - httpErr.Message = string(httpErr.Contents) + httpErr.Message = httpErr.ResponseBody response.LastError = &httpErr } else { - response.LastError = &gomatrix.HTTPError{ - Code: 0, - WrappedError: nil, + response.LastError = &mautrix.HTTPError{ + Response: &http.Response{StatusCode: 0}, + WrappedError: errors.New("unknown HTTP error"), Message: "Unknown HTTP error", } if lastErr != nil { @@ -298,14 +300,14 @@ func (r *FederationInternalAPI) PerformOutboundPeek( } // If we reach here then we didn't complete a peek for some reason. - var httpErr gomatrix.HTTPError + var httpErr mautrix.HTTPError if ok := errors.As(lastErr, &httpErr); ok { - httpErr.Message = string(httpErr.Contents) + httpErr.Message = httpErr.ResponseBody response.LastError = &httpErr } else { - response.LastError = &gomatrix.HTTPError{ - Code: 0, - WrappedError: nil, + response.LastError = &mautrix.HTTPError{ + Response: &http.Response{StatusCode: 0}, + WrappedError: lastErr, Message: lastErr.Error(), } } diff --git a/federationapi/queue/destinationqueue.go b/federationapi/queue/destinationqueue.go index f514d1411..0f74f23d5 100644 --- a/federationapi/queue/destinationqueue.go +++ b/federationapi/queue/destinationqueue.go @@ -14,11 +14,11 @@ import ( "sync/atomic" "time" - "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" + "maunium.net/go/mautrix" "github.com/element-hq/dendrite/federationapi/statistics" "github.com/element-hq/dendrite/federationapi/storage" @@ -470,14 +470,17 @@ func (oq *destinationQueue) nextTransaction( oq.transactionID = "" oq.transactionIDMutex.Unlock() return nil, sendMethod - case gomatrix.HTTPError: + case mautrix.HTTPError: // Report that we failed to send the transaction and we // will retry again, subject to backoff. // TODO: we should check for 500-ish fails vs 400-ish here, // since we shouldn't queue things indefinitely in response // to a 400-ish error - code := errResponse.Code + code := 0 + if errResponse.Response != nil { + code = errResponse.Response.StatusCode + } logrus.Debug("Transaction failed with HTTP", code) return err, sendMethod default: diff --git a/federationapi/routing/query.go b/federationapi/routing/query.go index 7c906bb76..f13bfd732 100644 --- a/federationapi/routing/query.go +++ b/federationapi/routing/query.go @@ -13,12 +13,12 @@ import ( roomserverAPI "github.com/element-hq/dendrite/roomserver/api" "github.com/element-hq/dendrite/roomserver/types" "github.com/element-hq/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/matrix-org/util" log "github.com/sirupsen/logrus" + "maunium.net/go/mautrix" ) // RoomAliasToID converts the queried alias into a room ID and returns it @@ -86,8 +86,8 @@ func RoomAliasToID( resp, err = federation.LookupRoomAlias(httpReq.Context(), domain, cfg.Matrix.ServerName, roomAlias) if err != nil { switch x := err.(type) { - case gomatrix.HTTPError: - if x.Code == http.StatusNotFound { + case mautrix.HTTPError: + if x.IsStatus(http.StatusNotFound) { return util.JSONResponse{ Code: http.StatusNotFound, JSON: spec.NotFound("Room alias not found"), diff --git a/go.mod b/go.mod index 2bfea799b..e2d9f4853 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/lib/pq v1.10.9 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-20250815065806-6697d93cbcba github.com/matrix-org/pinecone v0.11.1-0.20230810010612-ea4c33717fd7 github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 @@ -37,8 +36,8 @@ require ( github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.22.0 github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.10.0 - github.com/tidwall/gjson v1.18.0 + github.com/stretchr/testify v1.11.1 + github.com/tidwall/gjson v1.19.0 github.com/tidwall/sjson v1.2.5 github.com/uber/jaeger-client-go v2.30.0+incompatible github.com/uber/jaeger-lib v2.4.1+incompatible @@ -46,7 +45,7 @@ require ( github.com/yggdrasil-network/yggquic v0.0.0-20241212194307-0d495106021f go.uber.org/atomic v1.11.0 golang.org/x/crypto v0.40.0 - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 + golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc golang.org/x/image v0.27.0 golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b golang.org/x/sync v0.16.0 @@ -105,7 +104,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/juju/errors v1.0.0 // indirect github.com/klauspost/compress v1.18.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/minio/highwayhash v1.0.3 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect @@ -130,7 +129,7 @@ require ( github.com/quic-go/quic-go v0.48.2 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.13.1 // indirect - github.com/rs/zerolog v1.29.1 // indirect + github.com/rs/zerolog v1.34.0 // indirect github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.1 // indirect github.com/wlynxg/anet v0.0.5 // indirect @@ -142,12 +141,12 @@ require ( go.opentelemetry.io/otel/sdk v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.32.0 // indirect go.uber.org/mock v0.4.0 // indirect - golang.org/x/mod v0.25.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/mod v0.26.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/text v0.27.0 // indirect golang.org/x/time v0.12.0 // indirect - golang.org/x/tools v0.34.0 // indirect + golang.org/x/tools v0.35.0 // indirect google.golang.org/protobuf v1.36.5 // indirect gopkg.in/macaroon.v2 v2.1.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -161,3 +160,5 @@ require ( go 1.23.0 toolchain go1.24.3 + +replace github.com/matrix-org/gomatrixserverlib => github.com/Johennes/gomatrixserverlib v0.0.0-20260709080226-b33f290e934f diff --git a/go.sum b/go.sum index 7a1d9b68a..61c894c80 100644 --- a/go.sum +++ b/go.sum @@ -10,6 +10,8 @@ github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7Oputl github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= +github.com/Johennes/gomatrixserverlib v0.0.0-20260709080226-b33f290e934f h1:7xsKN+pPRDRRv185wecidVvpAhUAWkC9fDyZ7wgq758= +github.com/Johennes/gomatrixserverlib v0.0.0-20260709080226-b33f290e934f/go.mod h1:Ni4BxvLUAXpcvzghqp46gvpu04sVuNarF/5mq+cx51M= github.com/MFAshby/stdemuxerhook v1.0.0 h1:1XFGzakrsHMv76AeanPDL26NOgwjPl/OUxbGhJthwMc= github.com/MFAshby/stdemuxerhook v1.0.0/go.mod h1:nLMI9FUf9Hz98n+yAXsTMUR4RZQy28uCTLG1Fzvj/uY= github.com/Masterminds/semver/v3 v3.3.1 h1:QtNSWtVZ3nBfk8mAOu/B6v7FMJ+NHTIgUPi7rj+4nv4= @@ -235,24 +237,16 @@ github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e h1:DP5RC0Z3XdyBE github.com/matrix-org/dugong v0.0.0-20210921133753-66e6b1c67e2e/go.mod h1:NgPCr+UavRGH6n5jmdX8DuqFZ4JiCWIJoZiuhTRLSUg= github.com/matrix-org/go-sqlite3-js v0.0.0-20220419092513-28aa791a1c91 h1:s7fexw2QV3YD/fRrzEDPNGgTlJlvXY0EHHnT87wF3OA= 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-20250813150445-9f5070a65744 h1:5GvC2FD9O/PhuyY95iJQdNYHbDioEhMWdeMP9maDUL8= -github.com/matrix-org/gomatrixserverlib v0.0.0-20250813150445-9f5070a65744/go.mod h1:b6KVfDjXjA5Q7vhpOaMqIhFYvu5BuFVZixlNeTV/CLc= -github.com/matrix-org/gomatrixserverlib v0.0.0-20250814102638-60b9d3e5b634 h1:5MDrrj6hsTEW7Hv7rnWtSUQ4T4SUncFWQQG7vlrXnWw= -github.com/matrix-org/gomatrixserverlib v0.0.0-20250814102638-60b9d3e5b634/go.mod h1:b6KVfDjXjA5Q7vhpOaMqIhFYvu5BuFVZixlNeTV/CLc= -github.com/matrix-org/gomatrixserverlib v0.0.0-20250815065806-6697d93cbcba h1:vUUjTOXZ/bYdF/SmJPH8HZ/UTmvw+ldngFKVLElmn+I= -github.com/matrix-org/gomatrixserverlib v0.0.0-20250815065806-6697d93cbcba/go.mod h1:b6KVfDjXjA5Q7vhpOaMqIhFYvu5BuFVZixlNeTV/CLc= github.com/matrix-org/pinecone v0.11.1-0.20230810010612-ea4c33717fd7 h1:6t8kJr8i1/1I5nNttw6nn1ryQJgzVlBmSGgPiiaTdw4= github.com/matrix-org/pinecone v0.11.1-0.20230810010612-ea4c33717fd7/go.mod h1:ReWMS/LoVnOiRAdq9sNUC2NZnd1mZkMNB52QhpTRWjg= github.com/matrix-org/util v0.0.0-20221111132719-399730281e66 h1:6z4KxomXSIGWqhHcfzExgkH3Z3UkIXry4ibJS4Aqz2Y= github.com/matrix-org/util v0.0.0-20221111132719-399730281e66/go.mod h1:iBI1foelCqA09JJgPV0FYz4qA5dUXYOxMi57FxKBdd4= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= @@ -329,9 +323,9 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94 github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= -github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc= -github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= github.com/shoenig/test v1.11.0 h1:NoPa5GIoBwuqzIviCrnUJa+t5Xb4xi5Z+zODJnIDsEQ= github.com/shoenig/test v1.11.0/go.mod h1:UxJ6u/x2v/TNs/LoLxBNJRV9DiwBBKYxXSyczsBHFoI= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= @@ -346,11 +340,11 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY= -github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= +github.com/tidwall/gjson v1.19.0 h1:xwxm7n691Uf3u5OFjzngavjGTh55KX5q/9w9xHW88JU= +github.com/tidwall/gjson v1.19.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= @@ -412,8 +406,8 @@ golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc h1:TS73t7x3KarrNd5qAipmspBDS1rkMcgVG/fS1aRb4Rc= +golang.org/x/exp v0.0.0-20250711185948-6ae5c78190dc/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -425,16 +419,16 @@ golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b/go.mod h1:EiXZlVfUTaAyySF golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= -golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= +golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -449,12 +443,11 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= @@ -477,8 +470,8 @@ golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= -golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= +golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/roomserver/internal/perform/perform_leave.go b/roomserver/internal/perform/perform_leave.go index 88da777b8..ca526385d 100644 --- a/roomserver/internal/perform/perform_leave.go +++ b/roomserver/internal/perform/perform_leave.go @@ -14,11 +14,11 @@ import ( "time" "github.com/element-hq/dendrite/internal/eventutil" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/util" "github.com/sirupsen/logrus" + "maunium.net/go/mautrix/event" fsAPI "github.com/element-hq/dendrite/federationapi/api" "github.com/element-hq/dendrite/roomserver/api" @@ -114,7 +114,7 @@ func (r *Leaver) performLeaveRoomByID( if roomData, ok := accData.RoomAccountData[req.RoomID]; ok { tagData, ok := roomData["m.tag"] if ok { - tags := gomatrix.TagContent{} + tags := event.TagEventContent{} if err = json.Unmarshal(tagData, &tags); err != nil { return nil, fmt.Errorf("unable to unmarshal tag content") } diff --git a/userapi/internal/device_list_update.go b/userapi/internal/device_list_update.go index cea51b4d5..931a10d7d 100644 --- a/userapi/internal/device_list_update.go +++ b/userapi/internal/device_list_update.go @@ -22,11 +22,11 @@ import ( "github.com/matrix-org/gomatrixserverlib/fclient" "github.com/matrix-org/gomatrixserverlib/spec" - "github.com/matrix-org/gomatrix" "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/util" "github.com/prometheus/client_golang/prometheus" "github.com/sirupsen/logrus" + "maunium.net/go/mautrix" fedsenderapi "github.com/element-hq/dendrite/federationapi/api" "github.com/element-hq/dendrite/setup/process" @@ -554,11 +554,11 @@ func (u *DeviceListUpdater) processServerUser(ctx context.Context, serverName sp logger.WithError(e).Debug("GetUserDevices returned net.Error") return time.Minute * 10, err } - case gomatrix.HTTPError: + case mautrix.HTTPError: // The remote server returned an error, give it some time to recover. // This is to avoid spamming remote servers, which may not be Matrix servers anymore. - if e.Code >= 300 { - logger.WithError(e).Debug("GetUserDevices returned gomatrix.HTTPError") + if e.Response != nil && e.Response.StatusCode >= 300 { + logger.WithError(e).Debug("GetUserDevices returned mautrix.HTTPError") return hourWaitTime, err } default: