public function setIp($ipAddress, $isHex = false)
    {
        if ($isHex) {
            $this->ipHex = $ipAddress;
        } else {
            //discard any IPv6 port
            $ipAddress = preg_replace('/\[(.*?)\].*/', '$1', $ipAddress);
            //discard any IPv4 port
            if (strpos($ipAddress, '.') !== false) {
                $ipAddress = preg_replace('/(.*?(?:\d{1,3}\.?){4}).*/', "$1", $ipAddress);
            }
            $this->ipHex = bin2hex(inet_pton($ipAddress));
        }

        return $this;
    }