Store hashed ips. Display unique ip count in catalog
This commit is contained in:
@@ -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[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user