+backend base

This commit is contained in:
Miki 2023-12-21 10:52:56 +00:00
parent ebd2f05ae2
commit e9aec2b672
8 changed files with 402 additions and 0 deletions

14
backend/utils.go Normal file
View 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]
}