private boolean inWhiteList(String ip) {
String ips = "192.168.*.*,10.0.64.12";
String[] ipArray = ips.split(",");
try {
for (String ipRegex : ipArray) {
ipRegex = ipRegex.replace(".", "\\.");
ipRegex = ipRegex.replace("*", "(.*)");
if (ip.matches(ipRegex)) {
return true;
}
}
return false;
} catch (UnknownHostException e) {
return false;
}
}
IP白名单匹配
最新推荐文章于 2024-09-10 10:21:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)