REM:
1. 同时支持迪普设备两种清洗模式
2. 迪普旁路手动牵引模式支持设备就绪状态判断
This commit is contained in:
HuangXin 2021-01-18 16:55:18 +08:00
parent dae44b609e
commit 26283fe135
8 changed files with 94 additions and 2 deletions

View File

@ -101,6 +101,14 @@ public interface DisposeAbility {
*/
boolean isCarryProtectIp(String ipAddr);
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
boolean isCarryAttackType(Long attackType);
/**
* Period task runtime.
*/

View File

@ -2,6 +2,7 @@ package com.dispose.ability.impl;
import com.dispose.ability.DisposeAbility;
import com.dispose.common.CommonEnumHandler;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeObjectType;
@ -395,4 +396,15 @@ public class DpTechAbilityImpl implements DisposeAbility {
public void upgradeServiceGroup(List<ServiceInfo> svrList) {
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return !DDoSAttackType.maskToDdosAttackType(attackType).contains(DDoSAttackType.NONE_ATTACKS);
}
}

View File

@ -2,6 +2,7 @@ package com.dispose.ability.impl;
import com.dispose.common.CommonEnumHandler;
import com.dispose.common.ConstValue;
import com.dispose.common.DDoSAttackType;
import com.dispose.common.DisposeCapacityType;
import com.dispose.common.DisposeConfigValue;
import com.dispose.common.DisposeObjectType;
@ -165,8 +166,8 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
}
// 清理缓存中的对象
for(String v : disposeObjectCache.keySet()) {
if(disposeObjectCache.get(v).equals(objName)) {
for (String v : disposeObjectCache.keySet()) {
if (disposeObjectCache.get(v).equals(objName)) {
disposeObjectCache.remove(v);
}
}
@ -982,4 +983,31 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
}
return false;
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return DDoSAttackType.maskToDdosAttackType(attackType).contains(DDoSAttackType.NONE_ATTACKS);
}
/**
* Device ready boolean.
*
* @return the boolean
*/
@Override
public boolean deviceReady() {
if (disposeServiceGroup.keySet().size() == 0
|| dpBypassManager.getProtectObject().keySet().size() == 0
|| dpBypassManager.getProtectStrategy().keySet().size() == 0) {
return false;
}
return super.deviceReady();
}
}

View File

@ -278,6 +278,16 @@ public class HaoHanAbilityImpl implements DisposeAbility {
*/
@Override
public void upgradeServiceGroup(List<ServiceInfo> svrList) {
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return true;
}
}

View File

@ -389,7 +389,17 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
*/
@Override
public void upgradeServiceGroup(List<ServiceInfo> svrList) {
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return true;
}
}

View File

@ -537,6 +537,16 @@ public class PengXinAbilityImpl implements DisposeAbility {
*/
@Override
public void upgradeServiceGroup(List<ServiceInfo> svrList) {
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return true;
}
}

View File

@ -171,6 +171,16 @@ public class VirtualAbilityImpl implements DisposeAbility {
*/
@Override
public void upgradeServiceGroup(List<ServiceInfo> svrList) {
}
/**
* Is carry attack type boolean.
*
* @param attackType the attack type
* @return the boolean
*/
@Override
public boolean isCarryAttackType(Long attackType) {
return true;
}
}

View File

@ -475,6 +475,10 @@ public class DeviceTaskManagerServiceImpl implements DeviceTaskManagerService {
.getDisposeCapacity()))
// 当前设备是否支持处置该IP
.filter(c -> c.getDb().isCarryProtectIp(v.getDisposeObject()))
// 判断当前攻击类型是否支持
.filter(c -> c.getDb().isCarryAttackType(v.getAttackType()))
// 判断设备是否就绪
.filter(c -> c.getDb().deviceReady())
.forEach(d -> {
log.info("Add dispose task for device: {}", d.getDev());