fix(log/core): 兼容日志记录 IPv6 IP 归属地场景

This commit is contained in:
2024-06-20 22:51:09 +08:00
parent 332ef45c4a
commit 0bba30b9c4
2 changed files with 7 additions and 4 deletions

View File

@@ -44,8 +44,8 @@ public class IpUtils {
* @param ip IP 地址
* @return IP 归属地
*/
public static String getAddress(String ip) {
if (isInnerIp(ip)) {
public static String getIpv4Address(String ip) {
if (isInnerIpv4(ip)) {
return "内网IP";
}
Ip2regionSearcher ip2regionSearcher = SpringUtil.getBean(Ip2regionSearcher.class);
@@ -64,7 +64,7 @@ public class IpUtils {
* @param ip IP 地址
* @return 是否为内网 IP
*/
public static boolean isInnerIp(String ip) {
public static boolean isInnerIpv4(String ip) {
return NetUtil.isInnerIP("0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : HtmlUtil.cleanHtmlTag(ip));
}
}