修改拦截策略配置导入模板;修正http(s) 重定向配置导入校验

This commit is contained in:
zhangwenqing
2019-01-08 10:08:33 +08:00
parent 0bbb751020
commit 2c0ab8687b
8 changed files with 133 additions and 46 deletions

View File

@@ -193,7 +193,7 @@ public class ExportExcel {
commentStr=commentStr+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n"; commentStr=commentStr+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++; index++;
} }
defaultValue=ratelimit.get(0).getItemCode(); defaultValue="0.1";
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
@@ -215,18 +215,18 @@ public class ExportExcel {
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n"; commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++; index++;
} }
//defaultValue=dict.get(0).getItemCode(); defaultValue = "1";
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
/*commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n"; commentStr=commentStr+"\n"+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
if(!StringUtil.isEmpty(defaultValue)){ if(!StringUtil.isEmpty(defaultValue)){
//1、默认值说明 //1、默认值说明
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n"; commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++; index++;
index++; index++;
}*/ }
} }
/*** HTTP(s)重定向 重定向应答码 ***/ /*** HTTP(s)重定向 重定向应答码 ***/
if("redirect_response_code".equals(headerStr)){ if("redirect_response_code".equals(headerStr)){
@@ -237,7 +237,7 @@ public class ExportExcel {
commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n"; commentStr=commentStr+sysDataDictionaryItem.getItemCode()+""+msgProp.getProperty(sysDataDictionaryItem.getItemValue(),sysDataDictionaryItem.getItemValue())+"\n";
index++; index++;
} }
defaultValue = "1"; defaultValue = dict.get(0).getItemCode();
} }
commentStr=msgProp.getProperty("select")+":\n"+commentStr; commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++; index++;
@@ -908,8 +908,13 @@ public class ExportExcel {
commentStr=""; commentStr="";
List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL"); List<SysDataDictionaryItem> protocol=DictUtils.getDictList("PROTOCOL");
if(protocol !=null && protocol.size()>0){ 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) { for (SysDataDictionaryItem sysDataDictionaryItem : protocol) {
// IP拦截 监测 // 拦截策略(监测
if((sysDataDictionaryItem.getItemCode().equals("17")) && (region.getFunctionId().equals(200) && service.getAction().equals(1))){ if((sysDataDictionaryItem.getItemCode().equals("17")) && (region.getFunctionId().equals(200) && service.getAction().equals(1))){
continue; continue;
} }
@@ -936,7 +941,10 @@ public class ExportExcel {
defaultValue=region.getConfigProtocol().split(",")[0]; 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"; commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++; index++;
//2、默认值说明 //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++; index++;
} }
} }

View File

@@ -130,6 +130,9 @@ public class CheckComplexStringFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("301");
}
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码 String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
if (StringUtils.isNotBlank(userRegion1)) { if (StringUtils.isNotBlank(userRegion1)) {
@@ -146,6 +149,11 @@ public class CheckComplexStringFormatThread implements Callable<String>{
prop.getProperty("redirect_response_code") + " ") + ";"); 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)){ if(StringUtils.isNotBlank(userRegion2)){
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$"); Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
boolean bl = pat.matcher(userRegion2).matches(); boolean bl = pat.matcher(userRegion2).matches();

View File

@@ -404,6 +404,9 @@ public class CheckIpFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseIpCfg.getUserRegion1())) {
baseIpCfg.setUserRegion1("301");
}
String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码 String userRegion1 = baseIpCfg.getUserRegion1();// 重定向应答码
String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL String userRegion2 = baseIpCfg.getUserRegion2();// 重定向URL
if (StringUtils.isNotBlank(userRegion1)) { if (StringUtils.isNotBlank(userRegion1)) {
@@ -420,6 +423,11 @@ public class CheckIpFormatThread implements Callable<String>{
prop.getProperty("redirect_response_code") + " ") + ";"); 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)){ if(StringUtils.isNotBlank(userRegion2)){
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$"); Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
boolean bl = pat.matcher(userRegion2).matches(); 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)) { if (regionDict.getRegionType().equals(1)) {
boolean srcIpEmpty = false; boolean srcIpEmpty = false;
boolean destIpEmpty = false; boolean destIpEmpty = false;
@@ -743,7 +774,7 @@ public class CheckIpFormatThread implements Callable<String>{
//packet ip reject //packet ip reject
if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) { if(regionDict.getFunctionId().equals(5)&&serviceDict!=null&&serviceDict.getServiceId().equals(16)) {
baseIpCfg.setProtocol(6); baseIpCfg.setProtocol(6);
}else { }else if(!regionDict.getFunctionId().equals(200)) {
if (StringUtils.isBlank(regionDict.getConfigProtocol())) { if (StringUtils.isBlank(regionDict.getConfigProtocol())) {
baseIpCfg.setProtocol(0); baseIpCfg.setProtocol(0);
} else { } else {
@@ -763,6 +794,9 @@ public class CheckIpFormatThread implements Callable<String>{
+ String.format(prop.getProperty("alternative_values"), 6) + ";"); + String.format(prop.getProperty("alternative_values"), 6) + ";");
} }
} }
if(regionDict.getFunctionId().equals(200) && (serviceDict.getAction().equals(64))) {
protocol = "0,6,17";
}
// TODO 判断Protocol的值 // TODO 判断Protocol的值
if(baseIpCfg.getProtocol()==null) { if(baseIpCfg.getProtocol()==null) {
if(protocol.indexOf("0")>-1) { if(protocol.indexOf("0")>-1) {

View File

@@ -92,9 +92,6 @@ public class CheckStringFormatThread implements Callable<String>{
if(baseStringCfg.getCfgDesc().length() > 128) { if(baseStringCfg.getCfgDesc().length() > 128) {
errInfo.append(prop.getProperty("config_describe")+prop.getProperty("length_error")+" "+String.format(prop.getProperty("max_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.getRegionType().equals(2)) {
if (regionDict.getFunctionId().equals(510) && "p2p_hash".equals(regionDict.getConfigServiceType())) { 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())) { if (regionDict.getFunctionId().equals(200) && "intercept_domain".equals(regionDict.getConfigServiceType())) {
String userRegion5 = baseStringCfg.getUserRegion5();// 拦截强度 if(serviceDict.getAction().equals(1)) {
String userRegion2 = baseStringCfg.getUserRegion2();// 丢包率 if(StringUtils.isBlank(baseStringCfg.getUserRegion5())) {
if (StringUtils.isNotBlank(userRegion5)) { baseStringCfg.setUserRegion5("1");
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("INTERCEPT_DOMAIN_INTENSITY"); }
boolean has = false; String userRegion5 = baseStringCfg.getUserRegion5();// 拦截强度
for (SysDataDictionaryItem dict : dicts) { if (StringUtils.isNotBlank(userRegion5)) {
if (dict.getItemCode().equals(userRegion5)) { List<SysDataDictionaryItem> dicts = DictUtils.getDictList("INTERCEPT_DOMAIN_INTENSITY");
has = true; boolean has = false;
break; 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"), }else if(serviceDict.getAction().equals(64)) {
prop.getProperty("intercept_intensity") + " ") + ";"); baseStringCfg.setUserRegion1("0");// limit_rate_type限速方式默认值
if(StringUtils.isBlank(baseStringCfg.getUserRegion2())) {
baseStringCfg.setUserRegion2("0.1");
} }
} String userRegion2 = baseStringCfg.getUserRegion2();// 丢包率
if (StringUtils.isNotBlank(userRegion2)) { if (StringUtils.isNotBlank(userRegion2)) {
List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RATE_LIMIT"); List<SysDataDictionaryItem> dicts = DictUtils.getDictList("RATE_LIMIT");
boolean has = false; boolean has = false;
for (SysDataDictionaryItem dict : dicts) { for (SysDataDictionaryItem dict : dicts) {
if (dict.getItemCode().equals(userRegion2)) { if (dict.getItemCode().equals(userRegion2)) {
has = true; has = true;
break; 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)阻断 // 代理HTTP(s)阻断
if (regionDict.getFunctionId().equals(207)) { if (regionDict.getFunctionId().equals(207)) {
@@ -168,6 +178,9 @@ public class CheckStringFormatThread implements Callable<String>{
} }
// 代理 HTTP(s)重定向 // 代理 HTTP(s)重定向
if (regionDict.getFunctionId().equals(208)) { if (regionDict.getFunctionId().equals(208)) {
if(StringUtils.isBlank(baseStringCfg.getUserRegion1())) {
baseStringCfg.setUserRegion1("301");
}
String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码 String userRegion1 = baseStringCfg.getUserRegion1();// 重定向应答码
String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL String userRegion2 = baseStringCfg.getUserRegion2();// 重定向URL
if (StringUtils.isNotBlank(userRegion1)) { if (StringUtils.isNotBlank(userRegion1)) {
@@ -184,6 +197,11 @@ public class CheckStringFormatThread implements Callable<String>{
prop.getProperty("redirect_response_code") + " ") + ";"); 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)){ if(StringUtils.isNotBlank(userRegion2)){
Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$"); Pattern pat = Pattern.compile("^[hH][tT][tT][pP]([sS]?):\\/\\/(\\S+\\.)+\\S{2,}$");
boolean bl = pat.matcher(userRegion2).matches(); boolean bl = pat.matcher(userRegion2).matches();
@@ -214,10 +232,12 @@ public class CheckStringFormatThread implements Callable<String>{
} }
String keyword = baseStringCfg.getCfgKeywords(); 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)) { if (StringUtils.isBlank(keyword)) {
errInfo.append( errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("key_word") + " ") + ";"); 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 (mulityKeywordsP.equals("0")) {
if (keyword.indexOf("\n") > -1) { if (keyword.indexOf("\n") > -1) {
@@ -260,6 +280,8 @@ public class CheckStringFormatThread implements Callable<String>{
if (StringUtils.isBlank(keyword)) { if (StringUtils.isBlank(keyword)) {
errInfo.append( errInfo.append(
String.format(prop.getProperty("can_not_null"), prop.getProperty("domain_name") + " ") + ";"); 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 { }else {
Matcher m = pattern.matcher(keyword); Matcher m = pattern.matcher(keyword);
if (m.find()) { if (m.find()) {

View File

@@ -1365,7 +1365,10 @@ public class BaseController {
}else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 }else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class ); BlockingQueue<HttpsReplaceIpTemplate> list = ei.getDataList(HttpsReplaceIpTemplate.class );
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
} else { }else if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(64)) {// 拦截策略(限速)
BlockingQueue<IpRateLimitTemplate> list = ei.getDataList(IpRateLimitTemplate.class );
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict,null,asnGroupInfos, list);
}else {
BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class ); BlockingQueue<IpAllTemplate> list = ei.getDataList(IpAllTemplate.class );
ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list); ipPortCfgs=this.checkIpCfgMulity(errTip,serviceDict, regionDict, null,asnGroupInfos, list);
} }
@@ -1379,7 +1382,7 @@ public class BaseController {
BlockingQueue<AppDomainTemplate> list = ei.getDataList(AppDomainTemplate.class BlockingQueue<AppDomainTemplate> list = ei.getDataList(AppDomainTemplate.class
); );
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
}else if (regionDict.getFunctionId().equals(201)){// Domain Intercept }else if (regionDict.getFunctionId().equals(200)){// 拦截策略
if(serviceDict.getAction().equals(1)){// 监测 if(serviceDict.getAction().equals(1)){// 监测
BlockingQueue<DomainInterceptMonitTemplate> list = ei.getDataList(DomainInterceptMonitTemplate.class); BlockingQueue<DomainInterceptMonitTemplate> list = ei.getDataList(DomainInterceptMonitTemplate.class);
stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list); stringCfgs=this.checkStringCfgMulity(errTip,serviceDict, regionDict, list);
@@ -2150,6 +2153,8 @@ public class BaseController {
ei.loadInitParams(HttpsRedirectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict); ei.loadInitParams(HttpsRedirectIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
} else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换 } else if(regionDict.getFunctionId().equals(209)){// HTTP(s)替换
ei.loadInitParams(HttpsReplaceIpTemplate.class, this.getMsgProp(), regionDict, serviceDict); ei.loadInitParams(HttpsReplaceIpTemplate.class, this.getMsgProp(), regionDict, serviceDict);
} else if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().intValue()==64){// 拦截策略(限速)
ei.loadInitParams(IpRateLimitTemplate.class, msgProp, regionDict, serviceDict);
} else { } else {
ei.loadInitParams(IpAllTemplate.class, msgProp, regionDict, serviceDict); ei.loadInitParams(IpAllTemplate.class, msgProp, regionDict, serviceDict);
} }
@@ -2159,7 +2164,7 @@ public class BaseController {
ei.loadInitParams(P2pHashStringTemplate.class, msgProp, regionDict, serviceDict); ei.loadInitParams(P2pHashStringTemplate.class, msgProp, regionDict, serviceDict);
}else if (regionDict.getFunctionId().equals(403)) { }else if (regionDict.getFunctionId().equals(403)) {
ei.loadInitParams(AppDomainTemplate.class, msgProp, regionDict, serviceDict); ei.loadInitParams(AppDomainTemplate.class, msgProp, regionDict, serviceDict);
} else if(regionDict.getFunctionId().equals(201)){// Domain Intercept } else if(regionDict.getFunctionId().equals(200)){// 拦截策略 domain
if(serviceDict.getAction().equals(1)){// 监测 if(serviceDict.getAction().equals(1)){// 监测
ei.loadInitParams(DomainInterceptMonitTemplate.class, msgProp, regionDict, serviceDict); ei.loadInitParams(DomainInterceptMonitTemplate.class, msgProp, regionDict, serviceDict);
}else if(serviceDict.getAction().equals(64)){// 限速 }else if(serviceDict.getAction().equals(64)){// 限速

View File

@@ -386,6 +386,11 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,this.getMsgProp(),null, HttpsReplaceIpTemplate.class, 2);
excel.setDataList(this.getMsgProp(),classList,null). excel.setDataList(this.getMsgProp(),classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(200) && serviceDict.getAction().equals(64)) {// 拦截策略IP限速
List<IpRateLimitTemplate> classList=new ArrayList<IpRateLimitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpRateLimitTemplate.class, 2);
excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose();
}else{ }else{
List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>(); List<IpAllTemplate> classList=new ArrayList<IpAllTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, IpAllTemplate.class, 2);
@@ -405,7 +410,7 @@ public class IpController extends BaseController{
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, AppDomainTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, AppDomainTemplate.class, 2);
excel.setDataList(pro,classList,null). excel.setDataList(pro,classList,null).
write(request,response, fileName).dispose(); write(request,response, fileName).dispose();
}else if(regionDict.getFunctionId().equals(201)){// Domain Intercept }else if(regionDict.getFunctionId().equals(200)){// 拦截策略(域名)
if(serviceDict.getAction().equals(1)){// 监测 if(serviceDict.getAction().equals(1)){// 监测
List<DomainInterceptMonitTemplate> classList=new ArrayList<DomainInterceptMonitTemplate>(); List<DomainInterceptMonitTemplate> classList=new ArrayList<DomainInterceptMonitTemplate>();
ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DomainInterceptMonitTemplate.class, 2); ExportExcel excel=new ExportExcel(serviceDict,regionDict,pro,null, DomainInterceptMonitTemplate.class, 2);

View File

@@ -2340,10 +2340,11 @@ public abstract class BaseService {
umap.put("pps_threadshold", _cfg.getPpsThreadshold()); umap.put("pps_threadshold", _cfg.getPpsThreadshold());
maatCfg.setUserRegion(new Gson().toJson(umap)); maatCfg.setUserRegion(new Gson().toJson(umap));
}else if(regionDict.getFunctionId()==200) {// IP Intercept }else if(regionDict.getFunctionId()==200) {// IP Intercept
maatCfg.setUserRegion(Constants.USER_REGION_PLACEHOLDER); /*maatCfg.setUserRegion(Constants.USER_REGION_PLACEHOLDER);
if(_cfg.getAction().equals(Constants.MONIT_ACTION)) { if(_cfg.getAction().equals(Constants.MONIT_ACTION)) {
maatCfg.setUserRegion(Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"="+Constants.USER_REGION_PLACEHOLDER); maatCfg.setUserRegion(Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"="+Constants.USER_REGION_PLACEHOLDER);
} }*/
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+_cfg.getUserRegion2());
}else if(regionDict.getFunctionId()==207 || regionDict.getFunctionId()==208 || regionDict.getFunctionId()==209) {// HTTP(s)阻断、重定向、替换 }else if(regionDict.getFunctionId()==207 || regionDict.getFunctionId()==208 || regionDict.getFunctionId()==209) {// HTTP(s)阻断、重定向、替换
String userRegion = Constants.USER_REGION_PLACEHOLDER; String userRegion = Constants.USER_REGION_PLACEHOLDER;
if(_cfg.getAction().equals(Constants.REJECT_ACTION)) {// 阻断 if(_cfg.getAction().equals(Constants.REJECT_ACTION)) {// 阻断
@@ -2448,7 +2449,7 @@ public abstract class BaseService {
} }
}else if(regionDict.getDictId()==159) { }else if(regionDict.getDictId()==159) {
maatCfg.setUserRegion(Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion1()); maatCfg.setUserRegion(Constants.P2P_HASH_TYPE_USER_REGION_KEY+"="+_cfg.getUserRegion1());
}else if(regionDict.getFunctionId()==201) {// Domain Intercept }else if(regionDict.getFunctionId()==200) {// Domain Intercept
String userRegion = Constants.USERREGION_DOMAIN_ID+"="+_cfg.getCompileId()+";"+Constants.USERREGION_DOMAIN_STR+"="+_cfg.getCfgKeywords(); String userRegion = Constants.USERREGION_DOMAIN_ID+"="+_cfg.getCompileId()+";"+Constants.USERREGION_DOMAIN_STR+"="+_cfg.getCfgKeywords();
if(_cfg.getAction().equals(Constants.MONIT_ACTION)) {// 监测 需要发keyring_id、拦截强度 if(_cfg.getAction().equals(Constants.MONIT_ACTION)) {// 监测 需要发keyring_id、拦截强度
userRegion = Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"=0"+";"+Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+_cfg.getUserRegion5()+";" + userRegion; userRegion = Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"=0"+";"+Constants.INTERCEPT_DOMAN_INTENSITY_USER_REGION_KEY+"="+_cfg.getUserRegion5()+";" + userRegion;

View File

@@ -137,7 +137,7 @@ var resetIndex = function(){
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="address_pool"/></label> <label class="control-label col-md-3"><font color="red">*</font><spring:message code="address_pool"/></label>
<div class="col-md-6"> <div class="col-md-6">
<!-- 地址池名称 --> <!-- 地址池名称 -->
<input class="form-control required addrPoolUnique" type="text" name="addrPoolName" value="${_cfg.addrPoolName}" autocomplete="off" ctx="${ctx}"> <input class="form-control required addrPoolUnique" type="text" name="addrPoolName" value="${_cfg.addrPoolName}" maxlength="128" autocomplete="off" ctx="${ctx}">
</div> </div>
<div for="addrPoolName"></div> <div for="addrPoolName"></div>
</div> </div>