mirror of
https://github.com/mjl-/mox.git
synced 2024-12-25 16:03:48 +03:00
2535f351ed
firstly by using crypto/rand in those cases. and secondly by putting a lock around the Read (though it isn't used at the moment). found while working while implementing sending tls reports.
13 lines
344 B
Go
13 lines
344 B
Go
package mox
|
|
|
|
import (
|
|
cryptorand "crypto/rand"
|
|
"encoding/base64"
|
|
)
|
|
|
|
// MessageIDGen returns a generated unique random Message-Id value, excluding <>.
|
|
func MessageIDGen(smtputf8 bool) string {
|
|
buf := make([]byte, 16)
|
|
cryptorand.Read(buf)
|
|
return base64.RawURLEncoding.EncodeToString(buf) + "@" + Conf.Static.HostnameDomain.XName(smtputf8)
|
|
}
|