3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

use GenerateSecretToken for msgids

This commit is contained in:
Shivaram Lingamneni 2018-12-30 14:12:19 -05:00
parent c95ed46949
commit f35a1c7212
2 changed files with 1 additions and 11 deletions

View File

@ -9,7 +9,6 @@ import (
"bufio"
"crypto/tls"
"fmt"
"math/rand"
"net"
"net/http"
_ "net/http/pprof"
@ -371,13 +370,7 @@ func (server *Server) createListener(addr string, tlsConfig *tls.Config, bindMod
// generateMessageID returns a network-unique message ID.
func (server *Server) generateMessageID() string {
// we don't need the full like 30 chars since the unixnano below handles
// most of our uniqueness requirements, so just truncate at 5
lastbit := strconv.FormatInt(rand.Int63(), 36)
if 5 < len(lastbit) {
lastbit = lastbit[:4]
}
return fmt.Sprintf("%s%s", strconv.FormatInt(time.Now().UTC().UnixNano(), 36), lastbit)
return utils.GenerateSecretToken()
}
//

View File

@ -8,10 +8,8 @@ package main
import (
"fmt"
"log"
"math/rand"
"strings"
"syscall"
"time"
"github.com/docopt/docopt-go"
"github.com/oragono/oragono/irc"
@ -114,7 +112,6 @@ Options:
}
}
} else if arguments["run"].(bool) {
rand.Seed(time.Now().UTC().UnixNano())
if !arguments["--quiet"].(bool) {
logman.Info("startup", fmt.Sprintf("Oragono v%s starting", irc.SemVer))
if commit == "" {