REM:
1.修改浩瀚设备防护IP范围判断
This commit is contained in:
chenlinghy 2020-09-16 10:17:42 +08:00
parent 3d4e23b5a1
commit 189f9f97af
1 changed files with 18 additions and 15 deletions

View File

@ -9,6 +9,8 @@ import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.haohan.dispose.common.HaoHanStartCleanResp; import com.haohan.dispose.common.HaoHanStartCleanResp;
import com.haohan.dispose.common.HaoHanStopCleanResp; import com.haohan.dispose.common.HaoHanStopCleanResp;
import com.haohan.dispose.protocol.RestfulInterface; import com.haohan.dispose.protocol.RestfulInterface;
import inet.ipaddr.IPAddress;
import inet.ipaddr.IPAddressString;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; 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), HaoHanStartCleanResp resp = restfulInterface.startClean(this.urlRootPath, ip, Math.max(duration.intValue(), 0),
DISPOSE_PLATFORM_NAME); DISPOSE_PLATFORM_NAME);
if (resp == null) { if (resp == null) {
log.error("----Error Haohan start clean {} server return error", ip); 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(), HaoHanStopCleanResp resp = restfulInterface.stopClean(this.urlRootPath, taskId.intValue(),
DISPOSE_PLATFORM_NAME); DISPOSE_PLATFORM_NAME);
if (resp == null) { if (resp == null) {
log.error("----Error Haohan stop task{} server return error", taskId); log.error("----Error Haohan stop task{} server return error", taskId);
@ -139,18 +141,18 @@ public class HaoHanAbilityImpl implements DisposeAbility {
@Override @Override
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() { public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK, return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder() DeviceFirewareInfo.builder()
.vendor("HaoHan") .vendor("HaoHan")
.model("Unknown") .model("Unknown")
.firmware("Unknown") .firmware("Unknown")
.os("Linux Server") .os("Linux Server")
.kernel("Linux") .kernel("Linux")
.arch("x86_64") .arch("x86_64")
.version("Unknown") .version("Unknown")
.memory(-1) .memory(-1)
.freeMemory(-1) .freeMemory(-1)
.cpuUsed(-1) .cpuUsed(-1)
.build()); .build());
} }
/** /**
@ -179,6 +181,7 @@ public class HaoHanAbilityImpl implements DisposeAbility {
*/ */
@Override @Override
public boolean isCarryProtectIp(String ipAddr) { public boolean isCarryProtectIp(String ipAddr) {
return true; IPAddress addr = new IPAddressString(ipAddr).getAddress();
return addr.isIPv4();
} }
} }