From 495a73c005d4a2c2286d67cfc7a642f0c9ffd603 Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Tue, 30 Mar 2021 18:32:17 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=94=B9=E8=BF=AA?= =?UTF-8?q?=E6=99=AE=E8=AE=BE=E5=A4=87=E6=B7=BB=E5=8A=A0=E9=98=B2=E6=8A=A4?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E4=BB=A3=E7=A0=81=EF=BC=8CipV6=E7=9B=AE?= =?UTF-8?q?=E5=89=8D=E4=BB=85=E6=94=AF=E6=8C=81=E6=8E=A9=E7=A0=81=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/impl/DpTechBypassAbilityImpl.java | 26 ++++++++++++++++++- .../java/com/dispose/common/ConstValue.java | 10 +++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java b/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java index 7598546c..439dbd2e 100644 --- a/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/DpTechBypassAbilityImpl.java @@ -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)); + } } } diff --git a/src/main/java/com/dispose/common/ConstValue.java b/src/main/java/com/dispose/common/ConstValue.java index fe3daa9c..6457e992 100644 --- a/src/main/java/com/dispose/common/ConstValue.java +++ b/src/main/java/com/dispose/common/ConstValue.java @@ -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. *