修改拦截策略配置导入模板;修正http(s) 重定向配置导入校验
This commit is contained in:
@@ -193,7 +193,7 @@ public class ExportExcel {
|
||||
commentStr=commentStr+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue=ratelimit.get(0).getItemCode();
|
||||
defaultValue="0.1";
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
@@ -215,18 +215,18 @@ public class ExportExcel {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
//defaultValue=dict.get(0).getItemCode();
|
||||
defaultValue = "1";
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
/*commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
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++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
/*** HTTP(s)重定向 重定向应答码 ***/
|
||||
if("redirect_response_code".equals(headerStr)){
|
||||
@@ -237,7 +237,7 @@ public class ExportExcel {
|
||||
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+"("+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+")\n";
|
||||
index++;
|
||||
}
|
||||
defaultValue = "1";
|
||||
defaultValue = dict.get(0).getItemCode();
|
||||
}
|
||||
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
|
||||
index++;
|
||||
@@ -908,8 +908,13 @@ public class ExportExcel {
|
||||
commentStr="";
|
||||
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
|
||||
if(protocol !=null && protocol.size()>0){
|
||||
// 拦截策略(限速)
|
||||
if(region.getFunctionId().equals(200) && service.getAction().equals(64)) {
|
||||
commentStr=commentStr+"0("+msgProp.getProperty("arbitrary")+")"+"\n";
|
||||
index++;
|
||||
}
|
||||
for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
|
||||
// IP拦截 监测
|
||||
// 拦截策略(监测)
|
||||
if((sysDataDictionaryItem.getItemCode().equals("17")) && (region.getFunctionId().equals(200) && service.getAction().equals(1))){
|
||||
continue;
|
||||
}
|
||||
@@ -936,7 +941,10 @@ public class ExportExcel {
|
||||
defaultValue=region.getConfigProtocol().split(",")[0];
|
||||
}
|
||||
|
||||
|
||||
// 拦截策略(限速)
|
||||
if(region.getFunctionId().equals(200) && service.getAction().equals(64)) {
|
||||
defaultValue="0";
|
||||
}
|
||||
}
|
||||
/*}*/
|
||||
}
|
||||
@@ -1263,7 +1271,11 @@ public class ExportExcel {
|
||||
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
|
||||
index++;
|
||||
//2、默认值说明
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
|
||||
if(region.getFunctionId().equals(200)) {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":1\n";
|
||||
}else {
|
||||
commentStr=commentStr+"▶"+msgProp.getProperty("default_value")+":0\n";
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +130,9 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
@@ -146,6 +149,11 @@ public class CheckComplexStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("redirect_url"))
|
||||
+ ";");
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
|
||||
@@ -404,6 +404,9 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
|
||||
baseIpCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
@@ -420,6 +423,11 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("redirect_url"))
|
||||
+ ";");
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
@@ -449,6 +457,29 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
|
||||
}
|
||||
|
||||
// 拦截策略(限速)
|
||||
if (regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(64)) {
|
||||
baseIpCfg.setUserRegion1("0");// limit_rate_type(限速方式默认值)
|
||||
if(StringUtils.isBlank(baseIpCfg.getUserRegion2())) {
|
||||
baseIpCfg.setUserRegion2("0.1");
|
||||
}
|
||||
String userRegion2 = baseIpCfg.getUserRegion2();// 丢包率
|
||||
if (StringUtils.isNotBlank(userRegion2)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RATE_LIMIT");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion2)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("ratelimit") + " ") + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(1)) {
|
||||
boolean srcIpEmpty = false;
|
||||
boolean destIpEmpty = false;
|
||||
@@ -743,7 +774,7 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
//packet ip reject
|
||||
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
|
||||
baseIpCfg.setProtocol(6);
|
||||
}else {
|
||||
}else if(!regionDict.getFunctionId().equals(200)) {
|
||||
if (StringUtils.isBlank(regionDict.getConfigProtocol())) {
|
||||
baseIpCfg.setProtocol(0);
|
||||
} else {
|
||||
@@ -763,6 +794,9 @@ public class CheckIpFormatThread implements Callable<String>{
|
||||
+ String.format(prop.getProperty("alternative_values"), 6) + ";");
|
||||
}
|
||||
}
|
||||
if(regionDict.getFunctionId().equals(200) && (serviceDict.getAction().equals(64))) {
|
||||
protocol = "0,6,17";
|
||||
}
|
||||
// TODO 判断Protocol的值
|
||||
if(baseIpCfg.getProtocol()==null) {
|
||||
if(protocol.indexOf("0")>-1) {
|
||||
|
||||
@@ -92,9 +92,6 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
if(baseStringCfg.getCfgDesc().length() > 128) {
|
||||
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_length")+":128") + ";");
|
||||
}
|
||||
if(baseStringCfg.getCfgKeywords().length() < 4 || baseStringCfg.getCfgKeywords().length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
|
||||
if (regionDict.getRegionType().equals(2)) {
|
||||
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) {
|
||||
@@ -115,37 +112,50 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
}
|
||||
// 代理-域名拦截
|
||||
if (regionDict.getFunctionId().equals(201) && "intercept_domain".equals(regionDict.getConfigServiceType())) {
|
||||
String userRegion5 = baseStringCfg.getUserRegion5();// 拦截强度
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 丢包率
|
||||
if (StringUtils.isNotBlank(userRegion5)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("INTERCEPT_DOMAIN_INTENSITY");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion5)) {
|
||||
has = true;
|
||||
break;
|
||||
if (regionDict.getFunctionId().equals(200) && "intercept_domain".equals(regionDict.getConfigServiceType())) {
|
||||
if(serviceDict.getAction().equals(1)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion5())) {
|
||||
baseStringCfg.setUserRegion5("1");
|
||||
}
|
||||
String userRegion5 = baseStringCfg.getUserRegion5();// 拦截强度
|
||||
if (StringUtils.isNotBlank(userRegion5)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("INTERCEPT_DOMAIN_INTENSITY");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion5)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("intercept_intensity") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("intercept_intensity") + " ") + ";");
|
||||
|
||||
}else if(serviceDict.getAction().equals(64)) {
|
||||
baseStringCfg.setUserRegion1("0");// limit_rate_type(限速方式默认值)
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion2())) {
|
||||
baseStringCfg.setUserRegion2("0.1");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(userRegion2)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RATE_LIMIT");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion2)) {
|
||||
has = true;
|
||||
break;
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 丢包率
|
||||
if (StringUtils.isNotBlank(userRegion2)) {
|
||||
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RATE_LIMIT");
|
||||
boolean has = false;
|
||||
for (SysDataDictionaryItem dict : dicts) {
|
||||
if (dict.getItemCode().equals(userRegion2)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("ratelimit") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if (!has) {
|
||||
errInfo.append(String.format(prop.getProperty("is_incorrect"),
|
||||
prop.getProperty("ratelimit") + " ") + ";");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 代理HTTP(s)阻断
|
||||
if (regionDict.getFunctionId().equals(207)) {
|
||||
@@ -168,6 +178,9 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
// 代理 HTTP(s)重定向
|
||||
if (regionDict.getFunctionId().equals(208)) {
|
||||
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
|
||||
baseStringCfg.setUserRegion1("301");
|
||||
}
|
||||
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
|
||||
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
|
||||
if (StringUtils.isNotBlank(userRegion1)) {
|
||||
@@ -184,6 +197,11 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
prop.getProperty("redirect_response_code") + " ") + ";");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isBlank(userRegion2)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("redirect_url"))
|
||||
+ ";");
|
||||
}
|
||||
if(StringUtils.isNotBlank(userRegion2)){
|
||||
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
|
||||
boolean bl = pat.matcher(userRegion2).matches();
|
||||
@@ -214,10 +232,12 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
}
|
||||
|
||||
String keyword = baseStringCfg.getCfgKeywords();
|
||||
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(201)) {// 201域名拦截
|
||||
if (!regionDict.getFunctionId().equals(403) && !regionDict.getFunctionId().equals(200)) {// 201域名拦截
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";");
|
||||
}else if(keyword.length() < 4 || keyword.length() > 1024){
|
||||
errInfo.append(prop.getProperty("key_word")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}
|
||||
if (mulityKeywordsP.equals("0")) {
|
||||
if (keyword.indexOf("\n") > -1) {
|
||||
@@ -260,6 +280,8 @@ public class CheckStringFormatThread implements Callable<String>{
|
||||
if (StringUtils.isBlank(keyword)) {
|
||||
errInfo.append(
|
||||
String.format(prop.getProperty("can_not_null"), prop.getProperty("domain_name") + " ") + ";");
|
||||
}else if(keyword.length() < 4 || keyword.length() > 1024){
|
||||
errInfo.append(prop.getProperty("domain_name")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("min_length")+":4,"+prop.getProperty("max_length")+":1024") + ";");
|
||||
}else {
|
||||
Matcher m = pattern.matcher(keyword);
|
||||
if (m.find()) {
|
||||
|
||||
Reference in New Issue
Block a user