parent
ad09521250
commit
ca70018b0c
|
@ -857,7 +857,7 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
|
||||
if (Pattern.matches(ConstValue.ipAddrSegmentReg(), ipValue)) {
|
||||
// 添加到缓存
|
||||
tmpTable.put(key, ipValue);
|
||||
tmpTable.put(key, Helper.ipAddrToFullFormat(ipValue));
|
||||
} else {
|
||||
// 删除异常段
|
||||
NtcRequestResultInfo rsp = getCleanTypePort().deleteProtectionObjectIPRangeForUMC(objName
|
||||
|
@ -1053,10 +1053,12 @@ public class DpTechBypassAbilityImpl extends DpTechAbilityImpl {
|
|||
if (disposeServiceGroup.containsKey(v.getServiceId())) {
|
||||
if (!disposeServiceGroup.get(v.getServiceId()).equals(v)) {
|
||||
disposeServiceGroup.remove(v.getServiceId());
|
||||
v.setServiceIp(Helper.ipAddrToFullFormat(v.getServiceIp()));
|
||||
disposeServiceGroup.put(v.getServiceId(), v);
|
||||
}
|
||||
} else {
|
||||
//缓存和数据库中都不存在,则添加进缓存
|
||||
v.setServiceIp(Helper.ipAddrToFullFormat(v.getServiceIp()));
|
||||
disposeServiceGroup.put(v.getServiceId(), v);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import inet.ipaddr.AddressStringException;
|
|||
import inet.ipaddr.IPAddress;
|
||||
import inet.ipaddr.IPAddressSeqRange;
|
||||
import inet.ipaddr.IPAddressString;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -124,6 +123,28 @@ public class Helper {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip addr to full format string.
|
||||
*
|
||||
* @param ipAddr the ip addr
|
||||
* @return the string
|
||||
*/
|
||||
public static String ipAddrToFullFormat(String ipAddr) {
|
||||
String[] ipArrays = ipAddr.split("-");
|
||||
|
||||
for(int i = 0; i < ipArrays.length; i++) {
|
||||
IPAddressString addrString = new IPAddressString(ipArrays[i]);
|
||||
IPAddress addr = addrString.getAddress();
|
||||
ipArrays[i] = addr.toFullString().toUpperCase();
|
||||
}
|
||||
|
||||
if(ipArrays.length == 1) {
|
||||
return ipArrays[0];
|
||||
} else {
|
||||
return ipArrays[0] + "-" + ipArrays[1];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip port normalize string.
|
||||
*
|
||||
|
@ -238,7 +259,8 @@ public class Helper {
|
|||
* @return the boolean
|
||||
*/
|
||||
public static boolean isIpPortMatch(String originPort, String targetPort, HttpType portType) {
|
||||
String oPort, tPort;
|
||||
String oPort;
|
||||
String tPort;
|
||||
|
||||
if (portType == null) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue