@@ -0,0 +1,2655 @@
+package cn.howardliu.gear.commons.utils;%0A%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0A/**%0A * %3Cbr%3Ecreated at 2019/10/31%0A *%0A * @author liuxh%0A * @since 1.0.0%0A */%0Apublic class NetUtils %7B%0A    private static final Logger logger = LoggerFactory.getLogger(NetUtils.class);%0A%0A    public static String getIpAddress(HttpServletRequest request) %7B%0A        // %E8%8E%B7%E5%8F%96%E8%AF%B7%E6%B1%82%E4%B8%BB%E6%9C%BAIP%E5%9C%B0%E5%9D%80,%E5%A6%82%E6%9E%9C%E9%80%9A%E8%BF%87%E4%BB%A3%E7%90%86%E8%BF%9B%E6%9D%A5%EF%BC%8C%E5%88%99%E9%80%8F%E8%BF%87%E9%98%B2%E7%81%AB%E5%A2%99%E8%8E%B7%E5%8F%96%E7%9C%9F%E5%AE%9EIP%E5%9C%B0%E5%9D%80%0A        String ip = request.getHeader(%22X-Forwarded-For%22);%0A        if (logger.isInfoEnabled()) %7B%0A            logger.info(%22getIpAddress(HttpServletRequest) - X-Forwarded-For - String ip=%22 + ip);%0A        %7D%0A        if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A            if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A                ip = request.getHeader(%22Proxy-Client-IP%22);%0A                if (logger.isInfoEnabled()) %7B%0A                    logger.info(%22getIpAddress(HttpServletRequest) - Proxy-Client-IP - String ip=%22 + ip);%0A                %7D%0A            %7D%0A            if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A                ip = request.getHeader(%22WL-Proxy-Client-IP%22);%0A                if (logger.isInfoEnabled()) %7B%0A                    logger.info(%22getIpAddress(HttpServletRequest) - WL-Proxy-Client-IP - String ip=%22 + ip);%0A                %7D%0A            %7D%0A            if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A                ip = request.getHeader(%22HTTP_CLIENT_IP%22);%0A                if (logger.isInfoEnabled()) %7B%0A                    logger.info(%22getIpAddress(HttpServletRequest) - HTTP_CLIENT_IP - String ip=%22 + ip);%0A                %7D%0A            %7D%0A            if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A                ip = request.getHeader(%22HTTP_X_FORWARDED_FOR%22);%0A                if (logger.isInfoEnabled()) %7B%0A                    logger.info(%22getIpAddress(HttpServletRequest) - HTTP_X_FORWARDED_FOR - String ip=%22 + ip);%0A                %7D%0A            %7D%0A            if (ip == null %7C%7C ip.length() == 0 %7C%7C %22unknown%22.equalsIgnoreCase(ip)) %7B%0A                ip = request.getRemoteAddr();%0A                if (logger.isInfoEnabled()) %7B%0A                    logger.info(%22getIpAddress(HttpServletRequest) - getRemoteAddr - String ip=%22 + ip);%0A                %7D%0A            %7D%0A        %7D else if (ip.length() %3E 15) %7B%0A            String%5B%5D ips = ip.split(%22,%22);%0A            for (String ip1 : ips) %7B%0A                if (!(%22unknown%22.equalsIgnoreCase(ip1))) %7B%0A                    ip = ip1;%0A                    break;%0A                %7D%0A            %7D%0A        %7D%0A        return ip;%0A    %7D%0A%7D%0A

add NetUtils