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:
parent
c95ed46949
commit
f35a1c7212
@ -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()
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -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 == "" {
|
||||
|
Loading…
Reference in New Issue
Block a user