Store hashed ips. Display unique ip count in catalog

This commit is contained in:
Dominic Ferrando
2025-04-20 20:54:34 -04:00
parent 1148648aa4
commit c8b549115a
6 changed files with 63 additions and 19 deletions
+7
View File
@@ -1,6 +1,8 @@
package util
import (
"crypto/sha256"
"encoding/hex"
"net"
"net/http"
"strings"
@@ -43,3 +45,8 @@ func GetIP(r *http.Request) string {
}
return ip
}
func HashIp(ip string) string {
checksum := sha256.Sum256([]byte(ip))
return hex.EncodeToString(checksum[:])
}