diff --git a/neutrino-proxy-admin/src/views/proxy/portMapping.vue b/neutrino-proxy-admin/src/views/proxy/portMapping.vue index e322c736..67e84497 100644 --- a/neutrino-proxy-admin/src/views/proxy/portMapping.vue +++ b/neutrino-proxy-admin/src/views/proxy/portMapping.vue @@ -293,7 +293,7 @@ licenseId: undefined, licenseName: undefined, serverPort: undefined, - clientIp: undefined, + clientIp: '127.0.0.1', clientPort: undefined } }, diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/PortMappingController.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/PortMappingController.java index 6868bb1e..34ec8978 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/PortMappingController.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/PortMappingController.java @@ -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); }