app限速统一修改为userRegion1=0取限速userRegion2,

userRegion1=1取带宽userRegion3;
app增加VIGNORE自定义域,userRegion4 为空时,下发VIGNORE=1,非空时不下发VIGNORE
This commit is contained in:
DuanDongmei
2018-11-26 13:02:30 +08:00
parent 324100f949
commit 60f4b2316b
10 changed files with 146 additions and 54 deletions

View File

@@ -2066,13 +2066,13 @@
USER_REGION2 =#{userRegion2,jdbcType=VARCHAR},
<!-- </if>
<if test="userRegion3 != null and userRegion3 != ''"> -->
USER_REGION1 =#{userRegion3,jdbcType=VARCHAR},
USER_REGION3 =#{userRegion3,jdbcType=VARCHAR},
<!-- </if>
<if test="userRegion4 != null and userRegion4 != ''"> -->
USER_REGION1 =#{userRegion4,jdbcType=VARCHAR},
USER_REGION4 =#{userRegion4,jdbcType=VARCHAR},
<!-- </if>
<if test="userRegion5 != null and userRegion5 != ''"> -->
USER_REGION1 =#{userRegion5,jdbcType=VARCHAR},
USER_REGION5 =#{userRegion5,jdbcType=VARCHAR},
<!-- </if> -->
DO_LOG=#{doLog,jdbcType=INTEGER},
<if test="exprType != null">

View File

@@ -964,6 +964,23 @@ public class AppCfgService extends BaseService {
if (entity.getBehavCode() != null) {
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
}
// 限速业务需要设置
if (Constants.RATELIMIT_ACTION.equals(entity.getAction())) {
entity.setUserRegion1(StringUtil.isEmpty(entity.getUserRegion1()) ? "0":entity.getUserRegion1());
//限速 需要发Droprate=0.001 暂不支持Bandwidth=200kbps
if(entity.getUserRegion1().equals("0")){//丢包率
entity.setUserRegion2(StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2());
userRegion+=Constants.USER_REGION_SPLIT +Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion2();
}else if(entity.getUserRegion1().equals("1")){//带宽
entity.setUserRegion3(StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3());
userRegion+=Constants.USER_REGION_SPLIT +Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+entity.getUserRegion3();
}
}
//VIGNORE=1
if(StringUtil.isEmpty(entity.getUserRegion4())){
userRegion+=Constants.USER_REGION_SPLIT +Constants.APP_VIGNORE_USER_REGION_KEY+"=1";
}
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) {
@@ -973,14 +990,6 @@ public class AppCfgService extends BaseService {
}
}
// 限速业务需要设置
String actionCode = DictUtils.getDictCode("SERVICE_ACTION", "action_ratelimit");
if (!actionCode.equals("默认")) {
if (entity.getAction().equals(Integer.parseInt(actionCode))) {
userRegion += Constants.USER_REGION_SPLIT + Constants.RATE_LIMIT_REGION + "="
+ entity.getRatelimit();
}
}
maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);

View File

@@ -65,7 +65,7 @@ mail_keyword_control=Mail Keyword Block
mail_attachment_name_control=Mail Attachment Name Block
mail_attachment_content_control=Mail Attachment Content Block
file_transfer_control=File Transfer
ftp_address_control=FTP Url Block
ftp_address_control=FTP URL Block
ftp_name_control=FTP Filename Block
ftp_content_control=FTP File Content Block
http_app_feature=Application HTTP Feature
@@ -1311,4 +1311,5 @@ resp_body=Response Body
dns_sub=DNS Security
action_cache=Cache
action_cache_whitelist=Cache Bypass
crl_issuer_null=Issuer of CRL file is empty
crl_issuer_null=Issuer of CRL file is empty
block_by_app_server_ip=Block by application server ip

View File

@@ -1311,4 +1311,5 @@ resp_body=Response Body\u3001
dns_sub=DNS Security
action_cache=\u043A\u044D\u0448
action_cache_whitelist=\u0431\u0430\u0439\u043F\u0430\u0441 \u043A\u044D\u0448\u0430
crl_issuer_null=CRL\u6587\u4EF6\u7684\u9881\u53D1\u8005\u4E3A\u7A7A
crl_issuer_null=CRL\u6587\u4EF6\u7684\u9881\u53D1\u8005\u4E3A\u7A7A
block_by_app_server_ip=Block by application server ip

View File

@@ -1307,4 +1307,5 @@ resp_body=\u539F\u59CB\u5E94\u7B54\u4F53
dns_sub=DNS\u5B89\u5168\u673A\u5236
action_cache=\u7F13\u5B58
action_cache_whitelist=\u7F13\u5B58\u767D\u540D\u5355
crl_issuer_null=CRL\u6587\u4EF6\u7684\u9881\u53D1\u8005\u4E3A\u7A7A
crl_issuer_null=CRL\u6587\u4EF6\u7684\u9881\u53D1\u8005\u4E3A\u7A7A
block_by_app_server_ip=Block by application server ip

View File

@@ -556,4 +556,5 @@ max_allowed_packet=1048576
#http client\u8FDE\u63A5\u6C60\u76F8\u5173\u53C2\u6570\uFF0Chttp_max_connection:\u6700\u5927\u8FDE\u63A5\u6570\uFF0Cdefault_max_perroute:\u6BCF\u4E2A\u4E3B\u673A\u5730\u5740\u7684\u5E76\u53D1\u6570\uFF0Cpoolcm_socket_timeout:socket\u8D85\u65F6\u65F6\u95F4
http_max_connection=1000
default_max_perroute=100
poolcm_socket_timeout=3000
poolcm_socket_timeout=3000
app_vignore_user_region_key=VIGNORE

View File

@@ -5,13 +5,16 @@
<title><spring:message code="${cfgName}"></spring:message></title>
<script type="text/javascript">
$(function(){
$(".ratelimitAction").find("input[name='userRegion1']").on("change",function(){
switchRateLimitType();
});
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId"));
if($(".action:checked").val()==64){
$("#ratelimit").show();
$(".ratelimitAction").removeClass("hidden");
}else{
$("#ratelimit").hide();
$(".ratelimitAction").addClass("hidden");
}
if(($(".action:checked").val()==1) || ($(".action:checked").val()==16)){
$(".subscribeId").show();
@@ -26,9 +29,9 @@ $(function(){
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
if($(".action:checked").val()==64){
$("#ratelimit").show();
$(".ratelimitAction").removeClass("hidden");
}else{
$("#ratelimit").hide();
$(".ratelimitAction").addClass("hidden");
}
if(($(".action:checked").val()==1) || ($(".action:checked").val()==16)){
$(".subscribeId").show();
@@ -86,8 +89,8 @@ $(function(){
if($("[name='behavCode']")&&$("[name='behavCode']").val()!=""){
$("input[name='exprType']").val(1);
}
if($("input[name='ratelimit']").is(":hidden")){
$("input[name='ratelimit']").val("");
if($(".ratelimitAction").is(":hidden")){
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
}
loading('onloading...');
form.submit();
@@ -104,6 +107,21 @@ $(function(){
ajaxBehaviour($(this).val());
});
});
//限流方式
var switchRateLimitType=function(){
//0 丢包率 1 带宽
var rateLimitType=$(".ratelimitAction").find("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){
$(".droprate").removeClass("hidden");
$(".bandwith").addClass("hidden");
}
if(rateLimitType == 1){
$(".droprate").addClass("hidden");
$(".bandwith").removeClass("hidden");
}
}
var ajaxBehaviour=function(val){
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4);
var request=$.ajax({
@@ -292,22 +310,75 @@ var delContent = function(contentClassName, addBtnClassName) {
<div for="action"></div>
</div>
</div>
<div class="col-md-6" id="ratelimit">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3">
<input type="checkbox" name="userRegion4" class="child-checks" <c:if test="${_cfg.userRegion4 eq '1' }">checked</c:if> value="1">
</label>
<div class="col-md-6">
<select name="ratelimit" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.ratelimit==ratelimitC.itemCode || (_cfg.ratelimit==null && ratelimitC.itemCode eq '0.1')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
<label class="control-label">
<spring:message code="block_by_app_server_ip"/>
</label>
</div>
<div for="ratelimit"></div>
</div>
</div>
</div>
<div for="userRegion4"></div>
</div>
</div>
</div>
<div class="row ratelimitAction hidden">
<h4 class="form-section">
<spring:message code="action_region" />
<small></small>
</h4>
<div class="col-md-6 hidden">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="limit_rate_type"/></label>
<div class="col-md-6">
<label class="radio-inline">
<input type="radio"
name="userRegion1" value="0"
<%-- <c:if test="${(userRegion1 eq 0) || (empty userRegion1)}"> --%>
checked
<%-- </c:if> --%>
class="required" >
<spring:message code="ratelimit" />
</label>
<%-- <label class="radio-inline">
<input type="radio"
name="userRegion1" value="1"
<c:if test="${(userRegion1 eq 1)}">
checked
</c:if>
class="required" >
<spring:message code="bandwith" />
</label> --%>
</div>
<div for="userRegion1"></div>
</div>
</div>
<div class="col-md-6 droprate">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6">
<select name="userRegion2" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.userRegion2==ratelimitC.itemCode || (_cfg.userRegion2==null && ratelimitC.itemCode eq '0.1')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
</div>
<div for="userRegion2"></div>
</div>
</div>
<%-- <div class="col-md-6 bandwith">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="bandwith"/></label>
<div class="col-md-6">
<input class="form-control required number" type="text" name="userRegion3" value="${_cfg.userRegion3 }">
</div>
<div for="userRegion3"></div>
</div>
</div> --%>
</div>
</c:if>
<!-- subscribeId配置 -->
<div class="subscribeId" >

View File

@@ -372,6 +372,7 @@
<th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<th><spring:message code="ratelimit"/></th>
<th><spring:message code="block_by_app_server_ip"/></th>
<th class="sort-column r.action"><spring:message code="block_type"/></th>
<th><spring:message code="social_app"/></th>
<th><spring:message code="behaviour_type"/></th>
@@ -403,13 +404,21 @@
<td>${cfg.cfgDesc }</td>
<td>
<c:if test="${cfg.action eq 64}">
<c:forEach items="${fns:getDictList('RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.ratelimit==ratelimitC.itemCode}">
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<td>
<c:if test="${cfg.userRegion4 eq '1'}">
<spring:message code="yes"/>
</c:if>
<c:if test="${empty cfg.userRegion4}">
<spring:message code="no"/>
</c:if>
</td>
<td>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }" var="dict">
<c:if test="${dict.itemCode eq cfg.action }">

View File

@@ -123,7 +123,20 @@
});
//限流方式
var switchRateLimitType=function(){
//0 丢包率 1 带宽
var rateLimitType=$(".ratelimitAction").find("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){
$(".droprate").removeClass("hidden");
$(".bandwith").addClass("hidden");
}
if(rateLimitType == 1){
$(".droprate").addClass("hidden");
$(".bandwith").removeClass("hidden");
}
}
//业务窗口打开
var addContent = function(obj, contentClassName) {
var showDiv = $(obj).parent().parent().next();

View File

@@ -493,7 +493,7 @@ $(function(){
var ns = s.replace(/\t|\r|\n/mg, "");
$(this).val(ns);
});*/
$("input[name*='userRegion']").addClass("invisibleChar");
$("input[name*='userRegion'][type='text']").addClass("invisibleChar");
$("#cancel").on("click",function(){
window.history.back();
return false;
@@ -787,20 +787,6 @@ var setDefaultMatchMethod=function (obj){
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").selectpicker("refresh");
}
}
//限流方式
var switchRateLimitType=function(){
//0 丢包率 1 带宽
var rateLimitType=$(".ratelimitAction").find("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){
$(".droprate").removeClass("hidden");
$(".bandwith").addClass("hidden");
}
if(rateLimitType == 1){
$(".droprate").addClass("hidden");
$(".bandwith").removeClass("hidden");
}
}
var switchIpType=function(obj){
var type=$(obj).val();
var row=$(obj).parents('.row');