REM:
1. 修改迪普设备添加防护对象代码,ipV6目前仅支持掩码方式
This commit is contained in:
chenlinghy 2021-03-30 18:32:17 +08:00
parent 9d66b8784d
commit 495a73c005
2 changed files with 35 additions and 1 deletions

View File

@ -263,6 +263,25 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
return ipSegment + "-" + ipSegment;
}
/**
* Gets ipv6 segment format.
*
* @param ipSegment the ipv6 segment
* @return the ip segment format
*/
private String getIpV6SegmentFormat(String ipSegment) {
if(ipSegment.contains(ConstValue.IPV6_SEGMENT_SPILT)){
return ipSegment;
}
//如果输入格式为IP-IP则返回值为null
if(ipSegment.contains(ConstValue.IPV6_ERR_SEGMENT_SPILT)){
return null;
}
return ipSegment + "/" + 128;
}
/**
* Create traction strategy error code.
*
@ -482,7 +501,12 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
if (!k.contains(":")) {
ipV4.add(ipV4Idx++ + "_" + getIpSegmentFormat(k));
} else {
ipV6.add(ipV6Idx++ + "_" + getIpSegmentFormat(k));
if(getIpV6SegmentFormat(k) == null){
log.error("!!!!ipV6:{} format error", k);
return;
}else{
ipV6.add(ipV6Idx++ + "_" + getIpV6SegmentFormat(k));
}
}
}

View File

@ -94,6 +94,16 @@ public class ConstValue {
*/
public static final String[] IP_SEGMENT_SPILT = new String[] {"-", "/"};
/**
* The constant IPV6_ERR_SEGMENT_SPILT.
*/
public static final String IPV6_ERR_SEGMENT_SPILT = "-";
/**
* The constant IPV6_SEGMENT_SPILT.
*/
public static final String IPV6_SEGMENT_SPILT = "/";
/**
* The type Protocol.
*