Using the full IP address for ClientID.
This commit is contained in:
parent
784d10c1e9
commit
d0b006d51b
@ -5,7 +5,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
@ -13,9 +12,7 @@ import (
|
|||||||
// GenerateClientIDFromRequest generates a client id from the provided request.
|
// GenerateClientIDFromRequest generates a client id from the provided request.
|
||||||
func GenerateClientIDFromRequest(req *http.Request) string {
|
func GenerateClientIDFromRequest(req *http.Request) string {
|
||||||
ipAddress := GetIPAddressFromRequest(req)
|
ipAddress := GetIPAddressFromRequest(req)
|
||||||
ipAddressComponents := strings.Split(ipAddress, ":")
|
clientID := ipAddress + req.UserAgent()
|
||||||
ipAddressComponents[len(ipAddressComponents)-1] = ""
|
|
||||||
clientID := strings.Join(ipAddressComponents, ":") + req.UserAgent()
|
|
||||||
|
|
||||||
// Create a MD5 hash of this ip + useragent
|
// Create a MD5 hash of this ip + useragent
|
||||||
b := md5.Sum([]byte(clientID)) // nolint
|
b := md5.Sum([]byte(clientID)) // nolint
|
||||||
|
Loading…
x
Reference in New Issue
Block a user