proxy intercept ip功能完成
http\dns\ssl\mail dolog添加
This commit is contained in:
@@ -15,8 +15,8 @@ package com.nis.domain.configuration;
|
||||
* @date 2018年2月5日 下午3:34:14
|
||||
* @version V1.0
|
||||
*/
|
||||
public class InterceptPktBin extends ComplexkeywordCfg {
|
||||
private static final String tableName="pxy_intercept_pkt_bin";
|
||||
public class InterceptPktBin extends BaseStringCfg<InterceptPktBin> {
|
||||
private static final String tableName="intercept_pkt_bin";
|
||||
/**
|
||||
* @Fields serialVersionUID:TODO(用一句话描述这个变量表示什么)
|
||||
*
|
||||
|
||||
@@ -126,6 +126,11 @@ public final class Constants {
|
||||
public static final int ACTION_HMD = 8;
|
||||
public static final Integer DROP_ACTION = Configurations.getIntProperty("drop_action",32);
|
||||
public static final Integer LOOP_ACTION = Configurations.getIntProperty("loop_action",96);
|
||||
public static final Integer RATELIMIT_ACTION = Configurations.getIntProperty("ratelimit_action",64);
|
||||
public static final Integer REPLACE_ACTION = Configurations.getIntProperty("replace_action",80);
|
||||
public static final Integer MONIT_ACTION = Configurations.getIntProperty("monit_action",1);
|
||||
public static final Integer REJECT_ACTION = Configurations.getIntProperty("reject_action",16);
|
||||
public static final Integer WHITELIST_ACTION = Configurations.getIntProperty("reject_action",128);
|
||||
public static final int CFG_PAGE = 0;
|
||||
public static final int AUDIT_PAGE = 1;
|
||||
public static final String DEFAULT_CAPTCHA_PARAM = "captcha";
|
||||
@@ -569,6 +574,10 @@ public final class Constants {
|
||||
//P2P自定义域参数
|
||||
public static String P2P_IP_TYPE_USER_REGION_KEY=Configurations.getStringProperty("p2p_ip_type_user_region_key", "P2P_IP_TYPE");
|
||||
public static String P2P_HASH_TYPE_USER_REGION_KEY=Configurations.getStringProperty("p2p_hash_type_user_region_key", "P2P_HASH_TYPE");
|
||||
//PROXY INTERCEPT IP自定义域参数
|
||||
public static String INTERCEPT_IP_MONIT_USER_REGION_KEY=Configurations.getStringProperty("keyring_id", "keyring_id");
|
||||
public static String INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY=Configurations.getStringProperty("Droprate", "Droprate");
|
||||
public static String INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY=Configurations.getStringProperty("Bandwidth", "Bandwidth");
|
||||
|
||||
//大屏统计分析查询接口URL
|
||||
public static final String DASHBOARD_URL = Configurations.getStringProperty("dashboardUrl","dashboardUrl");
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.nis.web.controller.configuration.proxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -18,12 +20,17 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
import com.nis.domain.configuration.BaseStringCfg;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.ComplexkeywordCfg;
|
||||
import com.nis.domain.configuration.DnsResStrategy;
|
||||
import com.nis.domain.configuration.HttpUrlCfg;
|
||||
import com.nis.domain.configuration.InterceptPktBin;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.template.IpAddrTemplate;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
/**
|
||||
* IP相关配置控制类
|
||||
@@ -35,21 +42,13 @@ import com.nis.web.controller.configuration.CommonController;
|
||||
public class InterceptController extends CommonController{
|
||||
@RequestMapping(value = {"/ip/list"})
|
||||
// @RequiresPermissions(value={"website:dns:config"})
|
||||
public String dnsList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
public String ipList(Model model,@ModelAttribute("cfg")CfgIndexInfo cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
Page<CfgIndexInfo> searchPage=new Page<CfgIndexInfo>(request,response,"a");
|
||||
Page<CfgIndexInfo> page = websiteCfgService.getWebsiteList(searchPage, cfg);
|
||||
model.addAttribute("page", page);
|
||||
initPageCondition(model,cfg);
|
||||
return "/cfg/intercept/interceptIpList";
|
||||
}
|
||||
/*@RequestMapping(value = {"/ip/list"})
|
||||
// @RequiresPermissions(value={"intercept:ip:config","intercept:ip:confirm"},logical=Logical.OR)
|
||||
public String ipList(String cfgName,Model model,@ModelAttribute("cfg")IpPortCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
this._ipList(cfgName,model, cfg, request, response);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "/cfg/common/ipList";
|
||||
}*/
|
||||
@RequestMapping(value = {"/domain/list"})
|
||||
// @RequiresPermissions(value={"intercept:domain:config","intercept:domain:confirm"},logical=Logical.OR)
|
||||
public String domainList(String cfgName,Model model,@ModelAttribute("cfg")HttpUrlCfg cfg,HttpServletRequest request,HttpServletResponse response) {
|
||||
@@ -61,7 +60,7 @@ public class InterceptController extends CommonController{
|
||||
|
||||
@RequestMapping(value = {"/interceptIpForm"})
|
||||
@RequiresPermissions(value={"intercept:ip:config"})
|
||||
public String dnsForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
public String interceptIpForm(Model model,String ids,CfgIndexInfo entity) {
|
||||
if(StringUtils.isNotBlank(ids)){
|
||||
entity = interceptCfgService.getInterceptIpCfg(Long.parseLong(ids));
|
||||
initUpdateFormCondition(model,entity);
|
||||
@@ -75,14 +74,6 @@ public class InterceptController extends CommonController{
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/intercept/interceptIpForm";
|
||||
}
|
||||
/*@RequestMapping(value = {"/ip/form"})
|
||||
@RequiresPermissions(value={"intercept:ip:config"})
|
||||
public String ipForm(String cfgName,Model model,String ids,Integer functionId,BaseIpCfg entity) {
|
||||
this._ipForm(cfgName,model, ids, functionId, entity);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "/cfg/common/ipForm";
|
||||
}*/
|
||||
@RequestMapping(value = {"/domain/form"})
|
||||
@RequiresPermissions(value={"intercept:domain:config"})
|
||||
public String domainForm(String cfgName,Model model,String ids,Integer functionId,HttpUrlCfg entity) {
|
||||
@@ -91,29 +82,87 @@ public class InterceptController extends CommonController{
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "/cfg/common/domainForm";
|
||||
}
|
||||
@RequestMapping(value = {"saveOrUpdate"})
|
||||
public String saveInterceptIpCfg(Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
interceptCfgService.saveInterceptIpCfg(entity);
|
||||
@RequestMapping(value = {"/ip/saveOrUpdate"})
|
||||
public String saveInterceptIpCfg(RedirectAttributes redirectAttributes,Model model,HttpServletRequest request,HttpServletResponse response,String ids,CfgIndexInfo entity) {
|
||||
try {
|
||||
interceptCfgService.saveInterceptIpCfg(entity);
|
||||
addMessage(redirectAttributes,"save_success");
|
||||
} catch (Exception e) {
|
||||
addMessage(redirectAttributes,"save_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+entity.getFunctionId();
|
||||
}
|
||||
/*@RequestMapping(value = {"/ip/saveOrUpdate"})
|
||||
public String saveOrUpdateIp(String cfgName,RedirectAttributes model, IpPortCfg cfg) {
|
||||
this._saveOrUpdateIp(cfgName,model, cfg);
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+cfg.getFunctionId();
|
||||
}*/
|
||||
|
||||
@RequestMapping(value = {"ajaxInterceptIpSubList"})
|
||||
public String ajaxInterceptIpSubList(Model model,Long cfgId,Integer index) {
|
||||
CfgIndexInfo cfg = interceptCfgService.getInterceptIpCfg(cfgId);
|
||||
List<String[]> tabList = new ArrayList();
|
||||
if(cfg.getIpPortList()!=null){
|
||||
String cfgType = null;
|
||||
for(IpPortCfg ip:cfg.getIpPortList()){
|
||||
if(!ip.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"1",ip.getCfgType()});
|
||||
cfgType = ip.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(cfg.getInterceptPktBinList()!=null){
|
||||
String cfgType = null;
|
||||
for(BaseStringCfg keyword:cfg.getInterceptPktBinList()){
|
||||
if(!keyword.getCfgType().equals(cfgType)){
|
||||
tabList.add(new String[]{"2",keyword.getCfgType()});
|
||||
cfgType = keyword.getCfgType();
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
return "/cfg/intercept/interceptIpSubList";
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"auditInterceptIpCfg"})
|
||||
@RequiresPermissions(value={"intercept:ip:confirm"})
|
||||
public String auditInterceptIpCfg(Integer isAudit,Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
entity = interceptCfgService.getInterceptIpCfg(Long.parseLong(id));
|
||||
entity.setIsAudit(isAudit);
|
||||
entity.setIsValid(isValid);
|
||||
entity.setAuditorId(UserUtils.getUser().getId());
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
interceptCfgService.auditInterceptIpCfg(entity,isAudit);
|
||||
addMessage(redirectAttributes,"audit_success");
|
||||
} catch (MaatConvertException e) {
|
||||
logger.error("intercept ip audit failed",e);
|
||||
addMessage(redirectAttributes,"audit_failed");
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"updateInterceptIpValid"})
|
||||
@RequiresPermissions(value={"intercept:ip:config"})
|
||||
public String updateInterceptIpValid(Integer isValid,String ids,Integer functionId, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
interceptCfgService.updatInterceptValid(isValid,ids,functionId);
|
||||
addMessage(redirectAttributes,"delete_success");
|
||||
} catch (Exception e) {
|
||||
logger.error("intercept ip delete failed",e);
|
||||
addMessage(redirectAttributes,"delete_failed");
|
||||
}
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/domain/saveOrUpdate"})
|
||||
public String saveOrUpdateDomain(String cfgName,RedirectAttributes model, HttpUrlCfg cfg) {
|
||||
this._saveOrUpdateDomain(cfgName, model, cfg);
|
||||
return "redirect:" + adminPath +"/proxy/intercept/domain/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/ip/delete"})
|
||||
@RequiresPermissions("intercept:ip:config")
|
||||
public String deleteIp(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
this._deleteIp(cfgName,ids, compileIds, functionId, model);
|
||||
model.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+functionId;
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/domain/delete"})
|
||||
@RequiresPermissions("intercept:domain:config")
|
||||
public String deleteDomain(String cfgName,String ids,String compileIds,Integer functionId,RedirectAttributes model) {
|
||||
@@ -122,14 +171,6 @@ public class InterceptController extends CommonController{
|
||||
model.addAttribute("requiresPermissionPrefix","intercept:domain");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/domain/list?functionId="+functionId;
|
||||
}
|
||||
@RequestMapping(value = {"/ip/audit"})
|
||||
@RequiresPermissions("intercept:ip:confirm")
|
||||
public String auditIp(String cfgName,String ids,IpPortCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
this._auditIp(cfgName,ids, cfg, redirectAttributes);
|
||||
redirectAttributes.addAttribute("urlPrefix","/proxy/intercept/ip");
|
||||
redirectAttributes.addAttribute("requiresPermissionPrefix","intercept:ip");
|
||||
return "redirect:" + adminPath +"/proxy/intercept/ip/list?functionId="+cfg.getFunctionId();
|
||||
}
|
||||
@RequestMapping(value = {"/domain/audit"})
|
||||
@RequiresPermissions("intercept:domain:confirm")
|
||||
public String auditDomain(String ids,HttpUrlCfg cfg,RedirectAttributes redirectAttributes) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import com.nis.web.dao.MyBatisDao;
|
||||
public interface InterceptCfgDao extends CrudDao<CfgIndexInfo>{
|
||||
|
||||
public List<InterceptPktBin> getInterceptPktBin(CfgIndexInfo entity);
|
||||
public void insertInterceptPktBin(InterceptPktBin entity);
|
||||
public void saveInterceptPktBin(InterceptPktBin entity);
|
||||
public void deleteInterceptPktBin(CfgIndexInfo entity);
|
||||
public void deleteInterceptIpCfg(CfgIndexInfo entity);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
a.audit_time,a.service_id,a.request_id,a.compile_id,a.is_area_effective,a.classify,a.attribute,a.lable,
|
||||
a.expr_type,a.match_method,a.is_hexbin,a.area_effective_ids,a.function_id,a.cfg_region_code
|
||||
</sql>
|
||||
<select id="getInterceptPktBinList" resultMap="stringCfgMap">
|
||||
<select id="getInterceptPktBin" resultMap="stringCfgMap">
|
||||
SELECT
|
||||
<include refid="StrCfg_Column" />
|
||||
FROM intercept_pkt_bin a where compile_id=#{compileId} and function_id=#{functionId}
|
||||
@@ -109,7 +109,7 @@
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
<delete id="deleteDnsIpCfg" >
|
||||
<delete id="deleteInterceptIpCfg" >
|
||||
delete from ip_port_cfg where compile_id=#{compileId} and function_id=#{functionId}
|
||||
</delete>
|
||||
<!-- 删除pkt bin子配置 -->
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<result column="function_id" property="functionId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_id" property="dnsStrategyId" jdbcType="INTEGER" />
|
||||
<result column="dns_strategy_name" property="dnsStrategyName" jdbcType="VARCHAR" />
|
||||
<result column="do_log" property="doLog" jdbcType="INTEGER" />
|
||||
<result column="user_region1" property="userRegion1" jdbcType="VARCHAR" />
|
||||
<result column="user_region2" property="userRegion2" jdbcType="VARCHAR" />
|
||||
<result column="user_region3" property="userRegion3" jdbcType="VARCHAR" />
|
||||
@@ -129,7 +130,7 @@
|
||||
a.CREATOR_ID,a.CREATE_TIME,a.EDITOR_ID,a.EDIT_TIME,a.AUDITOR_ID,a.AUDIT_TIME,
|
||||
a.SERVICE_ID,a.REQUEST_ID,a.COMPILE_ID,a.IS_AREA_EFFECTIVE,a.CLASSIFY,
|
||||
a.ATTRIBUTE,a.LABLE,a.AREA_EFFECTIVE_IDS,a.function_id,a.dns_strategy_id,a.user_region1,
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5
|
||||
a.user_region2,a.user_region3,a.user_region4,a.user_region5,a.do_log
|
||||
</sql>
|
||||
<sql id="IpCfg_Column" >
|
||||
a.cfg_id,a.cfg_desc,a.ip_type,a.src_ip_address,a.ip_pattern,a.port_pattern,a.src_port
|
||||
@@ -405,7 +406,8 @@
|
||||
user_region2,
|
||||
user_region3,
|
||||
user_region4,
|
||||
user_region5
|
||||
user_region5,
|
||||
do_log
|
||||
)values (
|
||||
#{cfgDesc,jdbcType=VARCHAR},
|
||||
#{action,jdbcType=INTEGER},
|
||||
@@ -431,7 +433,8 @@
|
||||
#{userRegion2,jdbcType=VARCHAR},
|
||||
#{userRegion3,jdbcType=VARCHAR},
|
||||
#{userRegion4,jdbcType=VARCHAR},
|
||||
#{userRegion5,jdbcType=VARCHAR}
|
||||
#{userRegion5,jdbcType=VARCHAR},
|
||||
#{doLog,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<!-- insert ip_port_cfg表信息 -->
|
||||
@@ -807,6 +810,9 @@
|
||||
<if test="action != null" >
|
||||
action = #{action,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="doLog != null" >
|
||||
do_log = #{doLog,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="isValid != null" >
|
||||
is_valid = #{isValid,jdbcType=INTEGER},
|
||||
</if>
|
||||
|
||||
@@ -94,6 +94,12 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
*/
|
||||
|
||||
public void saveInterceptIpCfg(CfgIndexInfo entity){
|
||||
if(!entity.getAction().equals(Constants.REPLACE_ACTION)){
|
||||
entity.setInterceptPktBinList(null);
|
||||
}
|
||||
|
||||
entity.setIsValid(0);
|
||||
|
||||
//设置区域运营商信息
|
||||
setAreaEffectiveIds(entity);
|
||||
if(entity.getCfgId()==null){
|
||||
@@ -102,7 +108,12 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
List<Integer> idList = ConfigServiceUtil.getId(1, 1);
|
||||
if(idList!=null && idList.size()>0){
|
||||
compileId = idList.get(0);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
entity.setCompileId(compileId);
|
||||
entity.setCreateTime(new Date());
|
||||
entity.setCreatorId(entity.getCurrentUser().getId());
|
||||
@@ -113,11 +124,12 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
websiteCfgDao.saveIpPortCfg(cfg);
|
||||
}
|
||||
}
|
||||
if(entity.getInterceptPktBinList()!=null){
|
||||
|
||||
if(entity.getInterceptPktBinList()!=null ){
|
||||
for(InterceptPktBin cfg:entity.getInterceptPktBinList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
interceptCfgDao.insertInterceptPktBin(cfg);
|
||||
interceptCfgDao.saveInterceptPktBin(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,11 +141,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
areaIpCfgDao.saveAreaIpCfg(cfg);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("获取编译ID出错");
|
||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
@@ -160,7 +168,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
for(InterceptPktBin cfg:entity.getInterceptPktBinList()){
|
||||
if(StringUtils.isNotBlank(cfg.getCfgKeywords())){
|
||||
BeanUtils.copyProperties(entity, cfg,new String[]{"cfgRegionCode","cfgType"});
|
||||
interceptCfgDao.insertInterceptPktBin(cfg);
|
||||
interceptCfgDao.saveInterceptPktBin(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,13 +182,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
}
|
||||
}
|
||||
}
|
||||
/**//**
|
||||
/**
|
||||
* dns配置删除
|
||||
* @param isValid
|
||||
* @param ids
|
||||
* @param functionId
|
||||
*//*
|
||||
public void updateDnsCfgValid(Integer isValid,String ids,Integer functionId){
|
||||
*/
|
||||
public void updatInterceptValid(Integer isValid,String ids,Integer functionId){
|
||||
CfgIndexInfo entity = new CfgIndexInfo();
|
||||
String[] idArray = ids.split(",");
|
||||
for(String id :idArray){
|
||||
@@ -192,18 +200,18 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
entity.setFunctionId(functionId);
|
||||
websiteCfgDao.updateCfgValid(entity);
|
||||
//查询子配置
|
||||
entity = this.getDnsCfg(Long.parseLong(id));
|
||||
entity = this.getInterceptIpCfg(Long.parseLong(id));
|
||||
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(IpPortCfg.getTablename());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
if(entity.getDomainList()!=null && entity.getDomainList().size()>0)
|
||||
if(entity.getInterceptPktBinList()!=null && entity.getInterceptPktBinList().size()>0)
|
||||
{
|
||||
SslKeywordCfg cfg = new SslKeywordCfg();
|
||||
InterceptPktBin cfg = new InterceptPktBin();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(DnsDomainCfg.getTablename());
|
||||
cfg.setTableName(InterceptPktBin.getTablename());
|
||||
websiteCfgDao.updateCfgValid(cfg);
|
||||
}
|
||||
//保存区域IP信息
|
||||
@@ -217,13 +225,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
}
|
||||
|
||||
}
|
||||
*//**
|
||||
/**
|
||||
* dns配置审核
|
||||
* @param entity
|
||||
* @param isAudit
|
||||
* @throws MaatConvertException
|
||||
*//*
|
||||
public void auditDnsCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
*/
|
||||
public void auditInterceptIpCfg(CfgIndexInfo entity,Integer isAudit) throws MaatConvertException{
|
||||
//修改数据库审核状态信息
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
websiteCfgDao.auditCfg(entity);
|
||||
@@ -239,7 +247,7 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
List<IpCfg> areaIpRegionList = new ArrayList();
|
||||
|
||||
//查询子配置并修改审核状态
|
||||
entity = this.getDnsCfg(entity.getCfgId());
|
||||
entity = this.getInterceptIpCfg(entity.getCfgId());
|
||||
if(entity.getIpPortList()!=null && entity.getIpPortList().size()>0){
|
||||
IpPortCfg cfg = new IpPortCfg();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
@@ -254,13 +262,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
}
|
||||
}
|
||||
}
|
||||
if(entity.getDomainList()!=null && entity.getDomainList().size()>0){
|
||||
DnsDomainCfg cfg = new DnsDomainCfg();
|
||||
if(entity.getInterceptPktBinList()!=null && entity.getInterceptPktBinList().size()>0){
|
||||
InterceptPktBin cfg = new InterceptPktBin();
|
||||
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
|
||||
cfg.setTableName(DnsDomainCfg.getTablename());
|
||||
cfg.setTableName(InterceptPktBin.getTablename());
|
||||
websiteCfgDao.auditCfg(cfg);
|
||||
if(isAudit==1){
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getDomainList(),2,entity,groupRelationList);
|
||||
Map<String,List> map = cfgConvert(strRegionList,entity.getInterceptPktBinList(),2,entity,groupRelationList);
|
||||
groupRelationList=map.get("groupList");
|
||||
strRegionList=map.get("dstList");
|
||||
}
|
||||
@@ -293,11 +301,41 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
// dns reject userRegion=;dnsStrategyId;
|
||||
if(!StringUtil.isEmpty(entity.getDnsStrategyId())){
|
||||
// maatCfg.setUserRegion(Constants.USER_REGION_SPLIT+entity.getDnsStrategyId()+Constants.USER_REGION_SPLIT);
|
||||
maatCfg.setUserRegion(Constants.DNS_STRATEGY_USER_REGION_KEY+"="+entity.getDnsStrategyId());
|
||||
|
||||
//监测需要发keyring_id
|
||||
if(entity.getAction().equals(Constants.MONIT_ACTION)){
|
||||
entity.setUserRegion1(StringUtil.isEmpty(entity.getUserRegion1()) ? "0":entity.getUserRegion1());
|
||||
maatCfg.setUserRegion(Constants.INTERCEPT_IP_MONIT_USER_REGION_KEY+"="+entity.getUserRegion1());
|
||||
}
|
||||
//限速需要发Droprate=0.001 ,暂不支持Bandwidth=200kbps
|
||||
if(entity.getAction().equals(Constants.RATELIMIT_ACTION)){
|
||||
entity.setUserRegion2(StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2());
|
||||
|
||||
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion2());
|
||||
}
|
||||
String userRegion="";
|
||||
//替换需要发zone
|
||||
if(entity.getAction().equals(Constants.REPLACE_ACTION)){
|
||||
//HTTP replace: replace type is not null ;find is not null;replace with is not null(userRegion is not null)
|
||||
userRegion=Constants.REPLACE_ZONE_KEY+"="+entity.getUserRegion3();
|
||||
String substitute="";
|
||||
String userRegion4=StringUtil.isEmpty(entity.getUserRegion4()) ? "":entity.getUserRegion4();
|
||||
substitute="/";
|
||||
userRegion4 = BaseService.replaceContentEscape(userRegion4);
|
||||
substitute=substitute+userRegion4;
|
||||
|
||||
String userRegion5=StringUtil.isEmpty(entity.getUserRegion5()) ? "":entity.getUserRegion5();
|
||||
userRegion5 = BaseService.replaceContentEscape(userRegion5);
|
||||
substitute=substitute+"/"+userRegion5;
|
||||
|
||||
userRegion=userRegion+";"+Constants.REPLACE_SUBSTITUTE_KEY+"="+substitute;
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
|
||||
if(StringUtil.isEmpty(maatCfg.getUserRegion())){
|
||||
maatCfg.setUserRegion(Constants.USER_REGION_PLACEHOLDER);
|
||||
}
|
||||
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
@@ -306,10 +344,10 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("dns配置下发配置参数:"+json);
|
||||
logger.info("intercept IP 配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("dns配置下发响应信息:"+result.getMsg());
|
||||
logger.info("intercept IP 配置下发响应信息:"+result.getMsg());
|
||||
|
||||
}else if(isAudit==3){
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
@@ -323,10 +361,10 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("dns配置下发配置参数:"+json);
|
||||
logger.info("intercept IP 配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("dns配置取消配置响应信息:"+result.getMsg());
|
||||
logger.info("intercept IP 配置取消配置响应信息:"+result.getMsg());
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user