端口映射配置优化,不配置时,默认为127.0.0.1

This commit is contained in:
aoshiguchen
2023-03-15 18:34:08 +08:00
parent ecf0b97493
commit 97a248a16f
2 changed files with 6 additions and 2 deletions
@@ -293,7 +293,7 @@
licenseId: undefined,
licenseName: undefined,
serverPort: undefined,
clientIp: undefined,
clientIp: '127.0.0.1',
clientPort: undefined
}
},
@@ -6,6 +6,7 @@ import fun.asgc.neutrino.proxy.server.controller.req.*;
import fun.asgc.neutrino.proxy.server.controller.res.*;
import fun.asgc.neutrino.proxy.server.service.PortMappingService;
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
import org.apache.commons.lang3.StringUtils;
import org.noear.solon.annotation.*;
/**
@@ -33,8 +34,11 @@ public class PortMappingController {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
ParamCheckUtil.checkNotNull(req.getServerPort(), "serverPort");
ParamCheckUtil.checkNotEmpty(req.getClientIp(), "clientIp");
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
if (StringUtils.isBlank(req.getClientIp())) {
// 没传客户端ip,默认为127.0.0.1
req.setClientIp("127.0.0.1");
}
return portMappingService.create(req);
}