@@ -35,6 +35,7 @@ import (
35
35
"github.com/matrix-org/dendrite/setup/process"
36
36
userapiAPI "github.com/matrix-org/dendrite/userapi/api"
37
37
"github.com/matrix-org/gomatrixserverlib"
38
+ "github.com/matrix-org/gomatrixserverlib/spec"
38
39
"github.com/matrix-org/pinecone/types"
39
40
"github.com/sirupsen/logrus"
40
41
@@ -140,9 +141,9 @@ func (m *DendriteMonolith) SetStaticPeer(uri string) {
140
141
}
141
142
}
142
143
143
- func getServerKeyFromString (nodeID string ) (gomatrixserverlib .ServerName , error ) {
144
- var nodeKey gomatrixserverlib .ServerName
145
- if userID , err := gomatrixserverlib .NewUserID (nodeID , false ); err == nil {
144
+ func getServerKeyFromString (nodeID string ) (spec .ServerName , error ) {
145
+ var nodeKey spec .ServerName
146
+ if userID , err := spec .NewUserID (nodeID , false ); err == nil {
146
147
hexKey , decodeErr := hex .DecodeString (string (userID .Domain ()))
147
148
if decodeErr != nil || len (hexKey ) != ed25519 .PublicKeySize {
148
149
return "" , fmt .Errorf ("UserID domain is not a valid ed25519 public key: %v" , userID .Domain ())
@@ -154,15 +155,15 @@ func getServerKeyFromString(nodeID string) (gomatrixserverlib.ServerName, error)
154
155
if decodeErr != nil || len (hexKey ) != ed25519 .PublicKeySize {
155
156
return "" , fmt .Errorf ("Relay server uri is not a valid ed25519 public key: %v" , nodeID )
156
157
} else {
157
- nodeKey = gomatrixserverlib .ServerName (nodeID )
158
+ nodeKey = spec .ServerName (nodeID )
158
159
}
159
160
}
160
161
161
162
return nodeKey , nil
162
163
}
163
164
164
165
func (m * DendriteMonolith ) SetRelayServers (nodeID string , uris string ) {
165
- relays := []gomatrixserverlib .ServerName {}
166
+ relays := []spec .ServerName {}
166
167
for _ , uri := range strings .Split (uris , "," ) {
167
168
uri = strings .TrimSpace (uri )
168
169
if len (uri ) == 0 {
@@ -188,7 +189,7 @@ func (m *DendriteMonolith) SetRelayServers(nodeID string, uris string) {
188
189
m .p2pMonolith .RelayRetriever .SetRelayServers (relays )
189
190
} else {
190
191
relay .UpdateNodeRelayServers (
191
- gomatrixserverlib .ServerName (nodeKey ),
192
+ spec .ServerName (nodeKey ),
192
193
relays ,
193
194
m .p2pMonolith .ProcessCtx .Context (),
194
195
m .p2pMonolith .GetFederationAPI (),
@@ -215,7 +216,7 @@ func (m *DendriteMonolith) GetRelayServers(nodeID string) string {
215
216
relaysString += string (relay )
216
217
}
217
218
} else {
218
- request := api.P2PQueryRelayServersRequest {Server : gomatrixserverlib .ServerName (nodeKey )}
219
+ request := api.P2PQueryRelayServersRequest {Server : spec .ServerName (nodeKey )}
219
220
response := api.P2PQueryRelayServersResponse {}
220
221
err := m .p2pMonolith .GetFederationAPI ().P2PQueryRelayServers (m .p2pMonolith .ProcessCtx .Context (), & request , & response )
221
222
if err != nil {
@@ -291,7 +292,7 @@ func (m *DendriteMonolith) RegisterUser(localpart, password string) (string, err
291
292
pubkey := m .p2pMonolith .Router .PublicKey ()
292
293
userID := userutil .MakeUserID (
293
294
localpart ,
294
- gomatrixserverlib .ServerName (hex .EncodeToString (pubkey [:])),
295
+ spec .ServerName (hex .EncodeToString (pubkey [:])),
295
296
)
296
297
userReq := & userapiAPI.PerformAccountCreationRequest {
297
298
AccountType : userapiAPI .AccountTypeUser ,
@@ -342,7 +343,7 @@ func (m *DendriteMonolith) Start() {
342
343
343
344
prefix := hex .EncodeToString (pk )
344
345
cfg := monolith .GenerateDefaultConfig (sk , m .StorageDirectory , m .CacheDirectory , prefix )
345
- cfg .Global .ServerName = gomatrixserverlib .ServerName (hex .EncodeToString (pk ))
346
+ cfg .Global .ServerName = spec .ServerName (hex .EncodeToString (pk ))
346
347
cfg .Global .KeyID = gomatrixserverlib .KeyID (signing .KeyID )
347
348
cfg .Global .JetStream .InMemory = false
348
349
// NOTE : disabled for now since there is a 64 bit alignment panic on 32 bit systems
0 commit comments