style: 应用 Spotless 代码格式化

- 对所有 Java 源文件应用统一的代码格式化
- 统一缩进为 4 个空格
- 清理尾随空白字符和文件末尾换行
- 优化导入语句组织
- 总计格式化 654 个 Java 文件

有问题可以回滚或者找我聊
This commit is contained in:
irving
2025-08-30 21:21:08 -04:00
parent 7cafe17cd3
commit d719a047d8
619 changed files with 6491 additions and 6625 deletions

View File

@@ -1,13 +1,11 @@
package com.starry.common.utils.ip;
import com.starry.common.utils.RegionUtils;
import com.starry.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
/**
* @author admin
* 获取地址工具类
* @author admin 获取地址工具类
* @since 2022/7/25
*/
@Slf4j

View File

@@ -1,11 +1,9 @@
package com.starry.common.utils.ip;
import com.starry.common.utils.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.servlet.http.HttpServletRequest;
/**
* 获取IP方法
@@ -16,7 +14,8 @@ public class IpUtils {
/**
* 获取客户端IP
*
* @param request 请求对象
* @param request
* 请求对象
* @return IP地址
*/
public static String getIpAddr(HttpServletRequest request) {
@@ -47,7 +46,8 @@ public class IpUtils {
/**
* 检查是否为内部IP地址
*
* @param ip IP地址
* @param ip
* IP地址
* @return 结果
*/
public static boolean internalIp(String ip) {
@@ -58,7 +58,8 @@ public class IpUtils {
/**
* 检查是否为内部IP地址
*
* @param addr byte地址
* @param addr
* byte地址
* @return 结果
*/
private static boolean internalIp(byte[] addr) {
@@ -77,18 +78,18 @@ public class IpUtils {
final byte SECTION_5 = (byte) 0xC0;
final byte SECTION_6 = (byte) 0xA8;
switch (b0) {
case SECTION_1:
case SECTION_1 :
return true;
case SECTION_2:
case SECTION_2 :
if (b1 >= SECTION_3 && b1 <= SECTION_4) {
return true;
}
case SECTION_5:
case SECTION_5 :
switch (b1) {
case SECTION_6:
case SECTION_6 :
return true;
}
default:
default :
return false;
}
}
@@ -96,7 +97,8 @@ public class IpUtils {
/**
* 将IPv4地址转换成字节
*
* @param text IPv4地址
* @param text
* IPv4地址
* @return byte 字节
*/
public static byte[] textToNumericFormatV4(String text) {
@@ -110,7 +112,7 @@ public class IpUtils {
long l;
int i;
switch (elements.length) {
case 1:
case 1 :
l = Long.parseLong(elements[0]);
if ((l < 0L) || (l > 4294967295L)) {
return null;
@@ -120,7 +122,7 @@ public class IpUtils {
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 2:
case 2 :
l = Integer.parseInt(elements[0]);
if ((l < 0L) || (l > 255L)) {
return null;
@@ -134,7 +136,7 @@ public class IpUtils {
bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 3:
case 3 :
for (i = 0; i < 2; ++i) {
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
@@ -149,7 +151,7 @@ public class IpUtils {
bytes[2] = (byte) (int) (l >> 8 & 0xFF);
bytes[3] = (byte) (int) (l & 0xFF);
break;
case 4:
case 4 :
for (i = 0; i < 4; ++i) {
l = Integer.parseInt(elements[i]);
if ((l < 0L) || (l > 255L)) {
@@ -158,7 +160,7 @@ public class IpUtils {
bytes[i] = (byte) (int) (l & 0xFF);
}
break;
default:
default :
return null;
}
} catch (NumberFormatException e) {
@@ -196,7 +198,8 @@ public class IpUtils {
/**
* 从多级反向代理中获得第一个非unknown IP地址
*
* @param ip 获得的IP地址
* @param ip
* 获得的IP地址
* @return 第一个非unknown IP地址
*/
public static String getMultistageReverseProxyIp(String ip) {
@@ -216,10 +219,11 @@ public class IpUtils {
/**
* 检测给定字符串是否为未知多用于检测HTTP请求相关
*
* @param checkString 被检测的字符串
* @param checkString
* 被检测的字符串
* @return 是否未知
*/
public static boolean isUnknown(String checkString) {
return StringUtils.isBlank(checkString) || "unknown".equalsIgnoreCase(checkString);
}
}
}