Whitelist、Packet、Stream配置导入增加doLog属性.
This commit is contained in:
@@ -490,6 +490,34 @@ public class ExportExcel {
|
||||
index++;
|
||||
}
|
||||
|
||||
// doLog
|
||||
if("do_log".equals(headerStr)) {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("DO_LOG");
|
||||
if(dict !=null && dict.size()>0){
|
||||
String configDoLog = service.getConfigDoLog();
|
||||
String doLogOption = configDoLog.substring(configDoLog.indexOf(";"), configDoLog.lastIndexOf(";"));
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : dict) {
|
||||
String itemCode = sysDataDictionaryItem.getItemCode();
|
||||
if(doLogOption.contains(itemCode)) {
|
||||
commentStr=commentStr+itemCode+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
}
|
||||
defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
if(!StringUtil.isEmpty(defaultValue)){
|
||||
//1、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if(region.getRegionType().equals(1)){//IP配置
|
||||
//ip配置需要导入的信息:srcIp srcPort destIp destPort Protocol Direction
|
||||
//确定需要导入的srcIp srcPort destIp destPort信息
|
||||
|
||||
@@ -113,6 +113,9 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
|
||||
// doLog属性检验
|
||||
this.validDoLog(baseIpCfg,errInfo);
|
||||
|
||||
// 特殊字段验证
|
||||
// packet ip ratelimit
|
||||
if (serviceDict!=null&&serviceDict.getFunctionId().intValue() == 5 && serviceDict.getAction().intValue() == 64) {
|
||||
@@ -158,6 +161,10 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
// payload ip
|
||||
if (regionDict.getFunctionId().equals(212)) {
|
||||
// replace_zone
|
||||
if (StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
List<SysDataDictionaryItem> dict=DictUtils.getDictList("INTERCEPT_REPLACE_ZONE");
|
||||
baseIpCfg.setUserRegion1(dict.get(0).getItemCode());
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
Object val = DictUtils.getDictLabel("INTERCEPT_REPLACE_ZONE", userRegion1);
|
||||
@@ -165,9 +172,6 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"), prop.getProperty("replace_zone"))
|
||||
+ ";");
|
||||
}
|
||||
} else {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("replace_zone")) + ";");
|
||||
}
|
||||
|
||||
// replaced_content
|
||||
@@ -1153,7 +1157,31 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
errInfo.append(prop.get(ipName) + " " + prop.get("ip_range_smaller") + ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* doLog属性校验
|
||||
* @param baseIpCfg
|
||||
* @param errInfo
|
||||
*/
|
||||
public void validDoLog(IpPortCfg baseIpCfg, StringBuffer errInfo) {
|
||||
|
||||
String configDoLog = serviceDict.getConfigDoLog();
|
||||
if(StringUtils.isNotBlank(configDoLog)) {
|
||||
String defaultValue = configDoLog.substring(configDoLog.lastIndexOf(";")+1);
|
||||
String doLogOption = configDoLog.substring(configDoLog.indexOf(";")+1, configDoLog.lastIndexOf(";"));
|
||||
if(baseIpCfg.getDoLog() == null) {
|
||||
baseIpCfg.setDoLog(Integer.parseInt(defaultValue));
|
||||
}
|
||||
Integer doLog = baseIpCfg.getDoLog();
|
||||
if(!doLogOption.contains(doLog+"")) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("is_incorrect"), prop.getProperty("do_log"))
|
||||
+ ";");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位运算把 byte[] -> int
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user