REM:
1. 迪普设备防护IP不在范围内时,自动从设备上更新一次防护IP,再进行判断
This commit is contained in:
HuangXin 2020-09-24 10:58:14 +08:00
parent 8cb7831dff
commit 1d7da3354d
1 changed files with 20 additions and 6 deletions

View File

@ -92,9 +92,6 @@ public class DpTechAbilityImpl implements DisposeAbility {
//读取超时
policy.setReceiveTimeout(DpTechConfigValue.SOAP_RECEIVE_TIMEOUT_SECOND);
conduit.setClient(policy);
// 获取迪普设备防护IP
getDisposeDeviceProtectObject();
}
/**
@ -266,16 +263,33 @@ public class DpTechAbilityImpl implements DisposeAbility {
*/
@Override
public boolean isCarryProtectIp(String ipAddr) {
boolean ret = false;
IPAddress addr = new IPAddressString(ipAddr).getAddress();
synchronized (this) {
if (addr.isIPv4()) {
return protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
ret = protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
}
if (addr.isIPv6()) {
return protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
ret = protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
}
}
return false;
if (!ret) {
// 更新迪普设备防护IP
getDisposeDeviceProtectObject();
synchronized (this) {
if (addr.isIPv4()) {
ret = protectIpV4.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
}
if (addr.isIPv6()) {
ret = protectIpV6.stream().anyMatch(v -> Helper.ipInRange(v, ipAddr));
}
}
}
return ret;
}
}