多网IP探测优化
This commit is contained in:
@@ -295,7 +295,9 @@ public class AgentUtil {
|
||||
if (gateway.equals("N/A")) continue;
|
||||
|
||||
// 添加临时路由
|
||||
addTempRoute(ipv4, name, gateway);
|
||||
boolean flag = addTempRoute(ipv4, name, gateway);
|
||||
if (!flag) continue;
|
||||
|
||||
String ipInfo = PublicIpFetcher.getPublicIp();
|
||||
String publicIp = PublicIpFetcher.extractIp(ipInfo);
|
||||
if (publicIp != null) {
|
||||
@@ -366,7 +368,7 @@ public class AgentUtil {
|
||||
if(flag){
|
||||
AssertLog.info("添加临时路由成功,ipv4:{}",ipv4);
|
||||
}else{
|
||||
AssertLog.info("添加临时路由成功失败,ipv4:{}",ipv4);
|
||||
AssertLog.info("添加临时路由失败,ipv4:{}",ipv4);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@@ -377,11 +379,11 @@ public class AgentUtil {
|
||||
private static boolean delTempRoute(String ipv4, String name, String gateway) {
|
||||
String prefix = "32";
|
||||
AssertLog.info("删除临时路由,ipv4:{}",ipv4);
|
||||
boolean flag = NetworkUtil.addRoute(ipv4,prefix,gateway,name);
|
||||
boolean flag = NetworkUtil.deleteRoute(ipv4,prefix,gateway,name);
|
||||
if(flag){
|
||||
AssertLog.info("删除临时路由成功,ipv4:{}",ipv4);
|
||||
}else{
|
||||
AssertLog.info("删除临时路由成功失败,ipv4:{}",ipv4);
|
||||
AssertLog.info("删除临时路由失败,ipv4:{}",ipv4);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user