mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Run gofmt
This commit is contained in:
parent
deafd6d9b0
commit
00ca2be6a5
19 changed files with 27 additions and 18 deletions
|
|
@ -21,7 +21,7 @@ type Registration struct {
|
|||
AppToken string `yaml:"as_token"`
|
||||
ServerToken string `yaml:"hs_token"`
|
||||
SenderLocalpart string `yaml:"sender_localpart"`
|
||||
RateLimited *bool `yaml:"rate_limited,omitempty"`
|
||||
RateLimited *bool `yaml:"rate_limited,omitempty"`
|
||||
Namespaces Namespaces `yaml:"namespaces"`
|
||||
EphemeralEvents bool `yaml:"de.sorunome.msc2409.push_ephemeral,omitempty"`
|
||||
Protocols []string `yaml:"protocols,omitempty"`
|
||||
|
|
|
|||
|
|
@ -40,4 +40,4 @@ func (txnIDC *TransactionIDCache) MarkProcessed(txnID string) {
|
|||
}
|
||||
txnIDC.array[txnIDC.arrayPtr] = txnID
|
||||
txnIDC.lock.Unlock()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ const helloWorldRawFile = `{
|
|||
}
|
||||
}`
|
||||
const random16Bytes = "\x85\xb4\x16/\xcaO\x1d\xe6\x7f\x95\xeb\xdb+g\x11\xb1"
|
||||
|
||||
var random16BytesBase64 = base64.StdEncoding.EncodeToString([]byte(random16Bytes))
|
||||
|
||||
func parseHelloWorld() *EncryptedFile {
|
||||
|
|
|
|||
|
|
@ -45,12 +45,16 @@ const defaultPassphraseRounds = 100000
|
|||
|
||||
const exportPrefix = "-----BEGIN MEGOLM SESSION DATA-----\n"
|
||||
const exportSuffix = "-----END MEGOLM SESSION DATA-----\n"
|
||||
|
||||
// Only version 0x01 is currently specified in the spec
|
||||
const exportVersion1 = 0x01
|
||||
|
||||
// The standard for wrapping base64 is 76 bytes
|
||||
const exportLineLengthLimit = 76
|
||||
|
||||
// Byte count for version + salt + iv + number of rounds
|
||||
const exportHeaderLength = 1 + 16 + 16 + 4
|
||||
|
||||
// SHA-256 hash length
|
||||
const exportHashLength = 32
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
//go:build !nosas
|
||||
// +build !nosas
|
||||
|
||||
package crypto
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func (s *InboundGroupSession) GobDecode(rawPickled []byte) error {
|
|||
|
||||
func (s *InboundGroupSession) MarshalJSON() ([]byte, error) {
|
||||
pickled := s.Pickle(pickleKey)
|
||||
quotes := make([]byte, len(pickled) + 2)
|
||||
quotes := make([]byte, len(pickled)+2)
|
||||
quotes[0] = '"'
|
||||
quotes[len(quotes)-1] = '"'
|
||||
copy(quotes[1:len(quotes)-1], pickled)
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func (s *Session) GobDecode(rawPickled []byte) error {
|
|||
|
||||
func (s *Session) MarshalJSON() ([]byte, error) {
|
||||
pickled := s.Pickle(pickleKey)
|
||||
quotes := make([]byte, len(pickled) + 2)
|
||||
quotes := make([]byte, len(pickled)+2)
|
||||
quotes[0] = '"'
|
||||
quotes[len(quotes)-1] = '"'
|
||||
copy(quotes[1:len(quotes)-1], pickled)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
//go:build !nosas
|
||||
// +build !nosas
|
||||
|
||||
package olm
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ type SQLCryptoStore struct {
|
|||
PickleKey []byte
|
||||
Account *OlmAccount
|
||||
|
||||
olmSessionCache map[id.SenderKey]map[id.SessionID]*OlmSession
|
||||
olmSessionCache map[id.SenderKey]map[id.SessionID]*OlmSession
|
||||
olmSessionCacheLock sync.Mutex
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,4 +86,4 @@ func TestKey_Encrypt(t *testing.T) {
|
|||
decrypted, err := key1.Decrypt(evtType, encrypted)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, data, decrypted)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ func (mach *OlmMachine) markDeviceForUnwedging(sender id.UserID, senderKey id.Se
|
|||
func (mach *OlmMachine) checkIfWedged(evt *event.Event) {
|
||||
//content := evt.Content.AsEncrypted()
|
||||
// TODO implement
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
//go:build !nosas
|
||||
// +build !nosas
|
||||
|
||||
package crypto
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import (
|
|||
var (
|
||||
ErrNoVerificationFromDevice = errors.New("from_device field is empty")
|
||||
ErrNoVerificationMethods = errors.New("verification method list is empty")
|
||||
ErrNoRelatesTo = errors.New("missing m.relates_to info")
|
||||
ErrNoRelatesTo = errors.New("missing m.relates_to info")
|
||||
)
|
||||
|
||||
// ProcessInRoomVerification is a callback that is to be called when a client receives a message
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
//go:build !nosas
|
||||
// +build !nosas
|
||||
|
||||
package crypto
|
||||
|
|
|
|||
|
|
@ -42,4 +42,4 @@ type IgnoredUserListEventContent struct {
|
|||
|
||||
type IgnoredUser struct {
|
||||
// This is an empty object
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ func (uri *ContentURI) UnmarshalJSON(raw []byte) (err error) {
|
|||
} else if len(raw) < 2 || raw[0] != '"' || raw[len(raw)-1] != '"' {
|
||||
return InputNotJSONString
|
||||
}
|
||||
parsed, err := ParseContentURIBytes(raw[1:len(raw)-1])
|
||||
parsed, err := ParseContentURIBytes(raw[1 : len(raw)-1])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
roomIDLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org"}
|
||||
roomIDViaLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org", Via: []string{"maunium.net", "matrix.org"}}
|
||||
roomAliasLink = id.MatrixURI{Sigil1: '#', MXID1: "someroom:example.org"}
|
||||
roomIDEventLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org", Sigil2: '$', MXID2: "uOH4C9cK4HhMeFWkUXMbdF_dtndJ0j9je-kIK3XpV1s"}
|
||||
roomIDLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org"}
|
||||
roomIDViaLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org", Via: []string{"maunium.net", "matrix.org"}}
|
||||
roomAliasLink = id.MatrixURI{Sigil1: '#', MXID1: "someroom:example.org"}
|
||||
roomIDEventLink = id.MatrixURI{Sigil1: '!', MXID1: "7NdBVvkd4aLSbgKt9RXl:example.org", Sigil2: '$', MXID2: "uOH4C9cK4HhMeFWkUXMbdF_dtndJ0j9je-kIK3XpV1s"}
|
||||
roomAliasEventLink = id.MatrixURI{Sigil1: '#', MXID1: "someroom:example.org", Sigil2: '$', MXID2: "uOH4C9cK4HhMeFWkUXMbdF_dtndJ0j9je-kIK3XpV1s"}
|
||||
userLink = id.MatrixURI{Sigil1: '@', MXID1: "user:example.org"}
|
||||
userLink = id.MatrixURI{Sigil1: '@', MXID1: "user:example.org"}
|
||||
)
|
||||
|
||||
func TestMatrixURI_MatrixToURL(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func TestPushCondition_Match_KindEvent_MsgType(t *testing.T) {
|
|||
condition := newMatchPushCondition("content.msgtype", "m.emote")
|
||||
evt := newFakeEvent(event.EventMessage, &event.MessageEventContent{
|
||||
MsgType: event.MsgEmote,
|
||||
Body: "tests gomuks pushconditions",
|
||||
Body: "tests gomuks pushconditions",
|
||||
})
|
||||
assert.True(t, condition.Match(blankTestRoom, evt))
|
||||
}
|
||||
|
|
@ -28,7 +28,7 @@ func TestPushCondition_Match_KindEvent_MsgType_Fail(t *testing.T) {
|
|||
|
||||
evt := newFakeEvent(event.EventMessage, &event.MessageEventContent{
|
||||
MsgType: event.MsgText,
|
||||
Body: "I'm testing gomuks pushconditions",
|
||||
Body: "I'm testing gomuks pushconditions",
|
||||
})
|
||||
assert.False(t, condition.Match(blankTestRoom, evt))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ func TestEventToPushRules(t *testing.T) {
|
|||
evt := &event.Event{
|
||||
Type: event.AccountDataPushRules,
|
||||
Timestamp: 1523380910,
|
||||
Content: event.Content{
|
||||
Content: event.Content{
|
||||
VeryRaw: json.RawMessage(JSONExamplePushRules),
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue