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