拦截策略新增allow_http2

This commit is contained in:
wangwei
2019-05-28 13:36:36 +08:00
parent 84c10eac7d
commit e9bb74d9fd
14 changed files with 120 additions and 6 deletions

View File

@@ -413,6 +413,7 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
@@ -494,6 +495,13 @@ public class BaseIpCfg extends BaseCfg<BaseIpCfg> {
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;
}

View File

@@ -295,6 +295,7 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
protected String min;
protected String max;
protected Integer mirrorClient;
protected Integer allowHttp2;
protected Integer enable;
protected Integer mirrorProfile;
@@ -375,6 +376,12 @@ public class BaseStringCfg<T> extends BaseCfg<T> {
}
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public Integer getEnable() {
return enable;

View File

@@ -34,9 +34,11 @@ public class PxyInterceptCfg extends CfgIndexInfo {
private String max;
@ExcelField(title="ssl_ver_mirror_client",dictType="SYS_YES_NO",sort=20)
private String mirrorClient;
@ExcelField(title="decrypt_mirror_enable",dictType="SYS_YES_NO",sort=21)
@ExcelField(title="ssl_ver_allow_http2",dictType="SYS_YES_NO",sort=21)
private String allowHttp2;
@ExcelField(title="decrypt_mirror_enable",dictType="SYS_YES_NO",sort=22)
private String enable;
@ExcelField(title="decrypt_mirror_mirror_profile",sort=22)
@ExcelField(title="decrypt_mirror_mirror_profile",sort=23)
private String mirrorProfile;
private String userRegion1;
private String userRegion2;
@@ -120,6 +122,12 @@ public class PxyInterceptCfg extends CfgIndexInfo {
}
public void setMirrorClient(String mirrorClient) {
this.mirrorClient = mirrorClient;
}
public String getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(String allowHttp2) {
this.allowHttp2 = allowHttp2;
}
public String getEnable() {
return enable;

View File

@@ -29,6 +29,8 @@ public class InterceptDomainTemplate extends StringAllNotDoLogTemplate {
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@@ -124,14 +126,21 @@ public class InterceptDomainTemplate extends StringAllNotDoLogTemplate {
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=30)
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=30)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=31)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=31)
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=32)
public Integer getMirrorProfile() {
return mirrorProfile;
}

View File

@@ -30,6 +30,8 @@ public class InterceptIpTemplate extends IpAllNotDoLogTemplate {
private Integer mirrorClient;
private Integer allowHttp2;
private Integer enable;
private Integer mirrorProfile;
@@ -125,14 +127,21 @@ public class InterceptIpTemplate extends IpAllNotDoLogTemplate {
public void setMirrorClient(Integer mirrorClient) {
this.mirrorClient = mirrorClient;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=30)
@ExcelField(title="ssl_ver_allow_http2",align=2,sort=30)
public Integer getAllowHttp2() {
return allowHttp2;
}
public void setAllowHttp2(Integer allowHttp2) {
this.allowHttp2 = allowHttp2;
}
@ExcelField(title="decrypt_mirror_enable",align=2,sort=31)
public Integer getEnable() {
return enable;
}
public void setEnable(Integer enable) {
this.enable = enable;
}
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=31)
@ExcelField(title="decrypt_mirror_mirror_profile",align=2,sort=32)
public Integer getMirrorProfile() {
return mirrorProfile;
}

View File

@@ -896,6 +896,25 @@ public class ExportExcel {
index++;
}
}
//allow_http2
if("ssl_ver_allow_http2".equals(headerStr)) {
commentStr="";
defaultValue="1";
commentStr=msgProp.getProperty("select")+":\n"+commentStr;
index++;
commentStr+=1+""+msgProp.getProperty("yes")+"\n";
index++;
commentStr+=0+""+msgProp.getProperty("no")+"\n";
index++;
commentStr=commentStr+msgProp.getProperty("rule_desc_tip")+":\n";
index++;
//1、默认值说明
if(!StringUtil.isEmpty(defaultValue)){
commentStr=commentStr+""+msgProp.getProperty("default_value")+":"+defaultValue+"\n";
index++;
}
index++;
}
if("decrypt_mirror_enable".equals(headerStr)) {
commentStr="";
defaultValue="0";

View File

@@ -579,6 +579,7 @@ public class CheckIpFormatThread implements Callable<String>{
String min=baseIpCfg.getMin();
String max=baseIpCfg.getMax();
Integer mirrorClient=baseIpCfg.getMirrorClient();
Integer allowHttp2=baseIpCfg.getAllowHttp2();
Integer enable=baseIpCfg.getEnable();
Integer mirrorProfile=baseIpCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
@@ -726,6 +727,17 @@ public class CheckIpFormatThread implements Callable<String>{
if(StringUtils.isBlank(max)) {
max="tls13";
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();

View File

@@ -527,6 +527,7 @@ public class CheckStringFormatThread implements Callable<String>{
String min=baseStringCfg.getMin();
String max=baseStringCfg.getMax();
Integer mirrorClient=baseStringCfg.getMirrorClient();
Integer allowHttp2=baseStringCfg.getAllowHttp2();
Integer enable=baseStringCfg.getEnable();
Integer mirrorProfile=baseStringCfg.getMirrorProfile();
Map<String,Object> userRegionMap=new HashMap<>();
@@ -674,6 +675,17 @@ public class CheckStringFormatThread implements Callable<String>{
if(StringUtils.isBlank(max)) {
max="tls13";
}
if(allowHttp2==null) {
allowHttp2=1;
map.put("allow_http2", allowHttp2);
}else {
if(allowHttp2!=0&&allowHttp2!=1) {
errInfo.append(String.format(prop.getProperty("is_incorrect"),
prop.getProperty("ssl_ver_allow_http2","SSL version allow http2") + " ") + ";");
}else {
map.put("allow_http2", allowHttp2);
}
}
for(SysDataDictionaryItem sslversion: sslversions) {
if(sslversion.getItemCode().equals(min)) {
minSort=sslversion.getItemSort();

View File

@@ -198,6 +198,7 @@ public class InterceptController extends CommonController {
//ssl_ver
map=new HashMap<>();
String mirror_client=request.getParameter("mirror_client");
String allow_http2 = request.getParameter("allow_http2");
String min=request.getParameter("min");
String max=request.getParameter("max");
if(StringUtils.isNotBlank(mirror_client)){
@@ -206,6 +207,12 @@ public class InterceptController extends CommonController {
mirror_client="0";
map.put("mirror_client", 0);
}
if(StringUtils.isNotBlank(allow_http2)){
map.put("allow_http2", Integer.parseInt(allow_http2.trim()));
}else {
allow_http2="1";
map.put("allow_http2", 1);
}
if("0".equals(mirror_client)) {
if(StringUtils.isNotBlank(min)){
map.put("min", min.trim());
@@ -546,6 +553,9 @@ public class InterceptController extends CommonController {
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("mirror_client")) {
pxyInterceptCfg.setMirrorClient(((Map<String,Object>)userregion.get("ssl_ver")).get("mirror_client").toString());
}
if(((Map<String,Object>)userregion.get("ssl_ver")).containsKey("allow_http2")) {
pxyInterceptCfg.setAllowHttp2(((Map<String,Object>)userregion.get("ssl_ver")).get("allow_http2").toString());
}
if(((Map<String,Object>)userregion.get("decrypt_mirror")).containsKey("enable")) {
pxyInterceptCfg.setEnable(((Map<String,Object>)userregion.get("decrypt_mirror")).get("enable").toString());
}