From 189f9f97af95c8a379ab6dfdee4326bb27593f4d Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Wed, 16 Sep 2020 10:17:42 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=E4=BF=AE=E6=94=B9=E6=B5=A9?= =?UTF-8?q?=E7=80=9A=E8=AE=BE=E5=A4=87=E9=98=B2=E6=8A=A4IP=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ability/impl/HaoHanAbilityImpl.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java index 52eb142b..651bd522 100644 --- a/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java +++ b/src/main/java/com/dispose/ability/impl/HaoHanAbilityImpl.java @@ -9,6 +9,8 @@ import com.dispose.pojo.vo.DeviceFirewareInfo; import com.haohan.dispose.common.HaoHanStartCleanResp; import com.haohan.dispose.common.HaoHanStopCleanResp; import com.haohan.dispose.protocol.RestfulInterface; +import inet.ipaddr.IPAddress; +import inet.ipaddr.IPAddressString; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -71,7 +73,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { } HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip, Math.max(duration.intValue(), 0), - DISPOSE_PLATFORM_NAME); + DISPOSE_PLATFORM_NAME); if (resp == null) { log.error("----Error Haohan start clean {} server return error", ip); @@ -109,7 +111,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { } HaoHanStopCleanResp resp = restfulInterface.stopClean(this.urlRootPath, taskId.intValue(), - DISPOSE_PLATFORM_NAME); + DISPOSE_PLATFORM_NAME); if (resp == null) { log.error("----Error Haohan stop task{} server return error", taskId); @@ -139,18 +141,18 @@ public class HaoHanAbilityImpl implements DisposeAbility { @Override public MulReturnType getAbilityDeviceFireware() { return new MulReturnType<>(ErrorCode.ERR_OK, - DeviceFirewareInfo.builder() - .vendor("HaoHan") - .model("Unknown") - .firmware("Unknown") - .os("Linux Server") - .kernel("Linux") - .arch("x86_64") - .version("Unknown") - .memory(-1) - .freeMemory(-1) - .cpuUsed(-1) - .build()); + DeviceFirewareInfo.builder() + .vendor("HaoHan") + .model("Unknown") + .firmware("Unknown") + .os("Linux Server") + .kernel("Linux") + .arch("x86_64") + .version("Unknown") + .memory(-1) + .freeMemory(-1) + .cpuUsed(-1) + .build()); } /** @@ -179,6 +181,7 @@ public class HaoHanAbilityImpl implements DisposeAbility { */ @Override public boolean isCarryProtectIp(String ipAddr) { - return true; + IPAddress addr = new IPAddressString(ipAddr).getAddress(); + return addr.isIPv4(); } }