diff options
author | Christian <rk@racheklos.com> | 2021-08-05 10:53:04 +0200 |
---|---|---|
committer | Gabe Kangas <gabek@real-ity.com> | 2021-08-07 12:35:02 -0700 |
commit | d0b006d51b6d7e115bb96ed8e8f3f2d7916018dc (patch) | |
tree | 01aa1544de29ed367b4643c0059d327a6251d0f7 | |
parent | 784d10c1e95e8ef9b4986215b300eab2dda1e91b (diff) |
Using the full IP address for ClientID.
-rw-r--r-- | utils/clientId.go | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/utils/clientId.go b/utils/clientId.go index 2256d4743..e40b0d104 100644 --- a/utils/clientId.go +++ b/utils/clientId.go @@ -5,7 +5,6 @@ import ( "encoding/hex" "net" "net/http" - "strings" log "github.com/sirupsen/logrus" ) @@ -13,9 +12,7 @@ import ( // GenerateClientIDFromRequest generates a client id from the provided request. func GenerateClientIDFromRequest(req *http.Request) string { ipAddress := GetIPAddressFromRequest(req) - ipAddressComponents := strings.Split(ipAddress, ":") - ipAddressComponents[len(ipAddressComponents)-1] = "" - clientID := strings.Join(ipAddressComponents, ":") + req.UserAgent() + clientID := ipAddress + req.UserAgent() // Create a MD5 hash of this ip + useragent b := md5.Sum([]byte(clientID)) // nolint |