parent
cfa6513010
commit
62bf01ad5e
|
@ -30,6 +30,7 @@ import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -181,11 +182,16 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理缓存中的对象
|
// 清理缓存中的对象
|
||||||
for (String v : disposeObjectCache.keySet()) {
|
for (Map.Entry<String, String> entry : disposeObjectCache.entrySet()) {
|
||||||
if (disposeObjectCache.get(v).equals(objName)) {
|
if (entry.getKey().equals(objName)) {
|
||||||
disposeObjectCache.remove(v);
|
disposeObjectCache.remove(entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// for (String v : disposeObjectCache.keySet()) {
|
||||||
|
// if (disposeObjectCache.get(v).equals(objName)) {
|
||||||
|
// disposeObjectCache.remove(v);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
return ErrorCode.ERR_OK;
|
return ErrorCode.ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -484,8 +490,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查防护对象
|
// 检查防护对象
|
||||||
for (IpAddrType t : ipSegment.keySet()) {
|
for (Map.Entry<IpAddrType, String> entry : ipSegment.entrySet()) {
|
||||||
String protectName = getProtectObjectName(v.getServiceId(), t);
|
String protectName = getProtectObjectName(v.getServiceId(), entry.getKey());
|
||||||
|
|
||||||
// 防护对象存在
|
// 防护对象存在
|
||||||
if (dpBypassManager.getProtectObject().containsKey(protectName)) {
|
if (dpBypassManager.getProtectObject().containsKey(protectName)) {
|
||||||
|
@ -508,7 +514,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
boolean upgradeIpSegment = false;
|
boolean upgradeIpSegment = false;
|
||||||
|
|
||||||
// 判断防护IP段是否有变化
|
// 判断防护IP段是否有变化
|
||||||
if (IpAddrType.IPV4.equals(t)) {
|
if (IpAddrType.IPV4.equals(entry.getKey())) {
|
||||||
if (ipV4.size() != dp.getIpSegment().values().size()) {
|
if (ipV4.size() != dp.getIpSegment().values().size()) {
|
||||||
upgradeIpSegment = true;
|
upgradeIpSegment = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -520,7 +526,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
upgradeIpSegment = true;
|
upgradeIpSegment = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (IpAddrType.IPV6.equals(t)) {
|
} else if (IpAddrType.IPV6.equals(entry.getKey())) {
|
||||||
if (ipV6.size() != dp.getIpSegment().values().size()) {
|
if (ipV6.size() != dp.getIpSegment().values().size()) {
|
||||||
upgradeIpSegment = true;
|
upgradeIpSegment = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -537,8 +543,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
// 更新防护对象
|
// 更新防护对象
|
||||||
if (upgradeIpSegment) {
|
if (upgradeIpSegment) {
|
||||||
err = upgradeProtectObject(protectName,
|
err = upgradeProtectObject(protectName,
|
||||||
ipSegment.get(t),
|
ipSegment.get(entry.getKey()),
|
||||||
IpAddrType.IPV4.equals(t) ? 0 : 1,
|
IpAddrType.IPV4.equals(entry.getKey()) ? 0 : 1,
|
||||||
template);
|
template);
|
||||||
if (err == ErrorCode.ERR_OK) {
|
if (err == ErrorCode.ERR_OK) {
|
||||||
log.debug("upgrade Protection Object {} Succeed", protectName);
|
log.debug("upgrade Protection Object {} Succeed", protectName);
|
||||||
|
@ -548,8 +554,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err = createProtectObject(protectName,
|
err = createProtectObject(protectName,
|
||||||
ipSegment.get(t),
|
ipSegment.get(entry.getKey()),
|
||||||
IpAddrType.IPV4.equals(t) ? 0 : 1,
|
IpAddrType.IPV4.equals(entry.getKey()) ? 0 : 1,
|
||||||
template);
|
template);
|
||||||
if (err == ErrorCode.ERR_OK) {
|
if (err == ErrorCode.ERR_OK) {
|
||||||
log.debug("Add Protection Object {} Succeed", protectName);
|
log.debug("Add Protection Object {} Succeed", protectName);
|
||||||
|
|
Loading…
Reference in New Issue