+backend base
This commit is contained in:
parent
ebd2f05ae2
commit
e9aec2b672
8 changed files with 402 additions and 0 deletions
14
backend/utils.go
Normal file
14
backend/utils.go
Normal file
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func generateClientId(ip string, events []string, len int) string {
|
||||
str := ip + strings.Join(events, "|")
|
||||
id := sha256.Sum256([]byte(str))
|
||||
|
||||
return fmt.Sprintf("%X", id)[0:len]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue