mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 10:25:07 +08:00
[fix] 添加服务端ID
This commit is contained in:
@ -1,14 +1,12 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.client.application.command.lazy.netty.server.properties;
|
package org.framework.lazy.cloud.network.heartbeat.client.application.command.lazy.netty.server.properties;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
|
|
||||||
import java.lang.String;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.lang.Integer;
|
|
||||||
/**
|
/**
|
||||||
* describe 服务端配置信息
|
* describe 服务端配置信息
|
||||||
*
|
*
|
||||||
@ -21,7 +19,11 @@ import java.lang.Integer;
|
|||||||
@Schema(title = "lazy_netty_server_properties_query_List_command",description = "服务端配置信息")
|
@Schema(title = "lazy_netty_server_properties_query_List_command",description = "服务端配置信息")
|
||||||
public class LazyNettyServerPropertiesQueryListCommand {
|
public class LazyNettyServerPropertiesQueryListCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -22,6 +23,11 @@ import java.lang.Integer;
|
|||||||
public class LazyNettyServerPropertiesQueryOneCommand {
|
public class LazyNettyServerPropertiesQueryOneCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -22,6 +23,11 @@ import java.lang.Integer;
|
|||||||
public class LazyNettyServerPropertiesRemoveCommand {
|
public class LazyNettyServerPropertiesRemoveCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -22,6 +23,11 @@ import java.lang.Integer;
|
|||||||
public class LazyNettyServerPropertiesStoryCommand {
|
public class LazyNettyServerPropertiesStoryCommand {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -21,6 +22,11 @@ import java.lang.Integer;
|
|||||||
@Schema(title = "lazy_netty_server_properties_update_command",description = "服务端配置信息")
|
@Schema(title = "lazy_netty_server_properties_update_command",description = "服务端配置信息")
|
||||||
public class LazyNettyServerPropertiesUpdateCommand {
|
public class LazyNettyServerPropertiesUpdateCommand {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
private String serverId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.client.application.dto;
|
package org.framework.lazy.cloud.network.heartbeat.client.application.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
|
|
||||||
import java.lang.String;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.lang.Integer;
|
|
||||||
/**
|
/**
|
||||||
* describe 服务端配置信息
|
* describe 服务端配置信息
|
||||||
*
|
*
|
||||||
@ -22,6 +20,11 @@ import java.lang.Integer;
|
|||||||
public class LazyNettyServerPropertiesDTO {
|
public class LazyNettyServerPropertiesDTO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description = "命名空间", name = "serverId", example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -17,7 +17,6 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.sock
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
||||||
import org.wu.framework.core.NormalUsedString;
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
import org.wu.framework.lazy.orm.web.plus.stereotype.LazyApplication;
|
import org.wu.framework.lazy.orm.web.plus.stereotype.LazyApplication;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
@ -142,7 +141,7 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
|
|||||||
@Override
|
@Override
|
||||||
public Result<List<LazyNettyServerPropertiesDTO>> findList(LazyNettyServerPropertiesQueryListCommand lazyNettyServerPropertiesQueryListCommand) {
|
public Result<List<LazyNettyServerPropertiesDTO>> findList(LazyNettyServerPropertiesQueryListCommand lazyNettyServerPropertiesQueryListCommand) {
|
||||||
LazyNettyServerProperties lazyNettyServerProperties = LazyNettyServerPropertiesDTOAssembler.INSTANCE.toLazyNettyServerProperties(lazyNettyServerPropertiesQueryListCommand);
|
LazyNettyServerProperties lazyNettyServerProperties = LazyNettyServerPropertiesDTOAssembler.INSTANCE.toLazyNettyServerProperties(lazyNettyServerPropertiesQueryListCommand);
|
||||||
return lazyNettyServerPropertiesRepository.findList(lazyNettyServerProperties).convert(lazyNettyServerPropertiess -> lazyNettyServerPropertiess.stream().map(LazyNettyServerPropertiesDTOAssembler.INSTANCE::fromLazyNettyServerProperties).collect(Collectors.toList()));
|
return lazyNettyServerPropertiesRepository.findList(lazyNettyServerProperties).convert(lazyNettyServerPropertiesList -> lazyNettyServerPropertiesList.stream().map(LazyNettyServerPropertiesDTOAssembler.INSTANCE::fromLazyNettyServerProperties).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,6 +185,7 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
|
|||||||
public void starterOneClientSocket(LazyNettyServerProperties lazyNettyServerProperties) {
|
public void starterOneClientSocket(LazyNettyServerProperties lazyNettyServerProperties) {
|
||||||
boolean enabled = nettyClientProperties.isEnabled();
|
boolean enabled = nettyClientProperties.isEnabled();
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
String serverId = lazyNettyServerProperties.getServerId();
|
||||||
String inetHost = lazyNettyServerProperties.getInetHost();
|
String inetHost = lazyNettyServerProperties.getInetHost();
|
||||||
Integer inetPort = lazyNettyServerProperties.getInetPort();
|
Integer inetPort = lazyNettyServerProperties.getInetPort();
|
||||||
String clientId = lazyNettyServerProperties.getClientId();
|
String clientId = lazyNettyServerProperties.getClientId();
|
||||||
@ -196,12 +196,12 @@ public class LazyNettyServerPropertiesApplicationImpl implements LazyNettyServer
|
|||||||
if (ProtocolType.TCP.equals(protocolType)) {
|
if (ProtocolType.TCP.equals(protocolType)) {
|
||||||
nettyClientSocket = new
|
nettyClientSocket = new
|
||||||
NettyTcpClientSocket(inetHost, inetPort, clientId,
|
NettyTcpClientSocket(inetHost, inetPort, clientId,
|
||||||
NormalUsedString.DEFAULT, appKey, appSecret,
|
serverId, appKey, appSecret,
|
||||||
clientChangeEvent, handleChannelTypeAdvancedList);
|
clientChangeEvent, handleChannelTypeAdvancedList);
|
||||||
} else if (ProtocolType.UDP.equals(protocolType)) {
|
} else if (ProtocolType.UDP.equals(protocolType)) {
|
||||||
nettyClientSocket = new
|
nettyClientSocket = new
|
||||||
NettyUdpClientSocket(inetHost, inetPort, clientId,
|
NettyUdpClientSocket(inetHost, inetPort, clientId,
|
||||||
NormalUsedString.DEFAULT, appKey, appSecret,
|
serverId, appKey, appSecret,
|
||||||
clientChangeEvent, handleChannelTypeAdvancedList);
|
clientChangeEvent, handleChannelTypeAdvancedList);
|
||||||
} else {
|
} else {
|
||||||
nettyClientSocket = null;
|
nettyClientSocket = null;
|
||||||
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* netty 客户服务端地址配置属性
|
* netty 客户服务端地址配置属性
|
||||||
@ -13,6 +14,11 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@Data
|
@Data
|
||||||
public class NettyClientProperties {
|
public class NettyClientProperties {
|
||||||
public static final String PREFIX = "spring.lazy.netty.client";
|
public static final String PREFIX = "spring.lazy.netty.client";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
private String serverId= NormalUsedString.DEFAULT;
|
||||||
/**
|
/**
|
||||||
* 服务端地址 如:127.0.0.1
|
* 服务端地址 如:127.0.0.1
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,9 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
|
|||||||
|
|
||||||
private final LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication;
|
private final LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication;
|
||||||
|
|
||||||
public NettyClientSocketApplicationListener(NettyClientProperties nettyClientProperties, LazyLambdaStream lazyLambdaStream, LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication) {
|
public NettyClientSocketApplicationListener(NettyClientProperties nettyClientProperties,
|
||||||
|
LazyLambdaStream lazyLambdaStream,
|
||||||
|
LazyNettyServerPropertiesApplication lazyNettyServerPropertiesApplication) {
|
||||||
this.nettyClientProperties = nettyClientProperties;
|
this.nettyClientProperties = nettyClientProperties;
|
||||||
this.lazyLambdaStream = lazyLambdaStream;
|
this.lazyLambdaStream = lazyLambdaStream;
|
||||||
this.lazyNettyServerPropertiesApplication = lazyNettyServerPropertiesApplication;
|
this.lazyNettyServerPropertiesApplication = lazyNettyServerPropertiesApplication;
|
||||||
@ -44,12 +46,14 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
|
|||||||
String appKey = nettyClientProperties.getAppKey();
|
String appKey = nettyClientProperties.getAppKey();
|
||||||
String appSecret = nettyClientProperties.getAppSecret();
|
String appSecret = nettyClientProperties.getAppSecret();
|
||||||
ProtocolType protocolType = nettyClientProperties.getProtocolType();
|
ProtocolType protocolType = nettyClientProperties.getProtocolType();
|
||||||
|
String serverId = nettyClientProperties.getServerId();
|
||||||
if (Objects.isNull(clientId) ||
|
if (Objects.isNull(clientId) ||
|
||||||
Objects.isNull(inetHost)) {
|
Objects.isNull(inetHost)) {
|
||||||
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
|
log.warn("配置信息为空,请通过页面添加配置信息:{}", nettyClientProperties);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = new LazyNettyServerPropertiesDO();
|
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = new LazyNettyServerPropertiesDO();
|
||||||
|
lazyNettyServerPropertiesDO.setServerId(serverId);
|
||||||
lazyNettyServerPropertiesDO.setClientId(clientId);
|
lazyNettyServerPropertiesDO.setClientId(clientId);
|
||||||
lazyNettyServerPropertiesDO.setInetHost(inetHost);
|
lazyNettyServerPropertiesDO.setInetHost(inetHost);
|
||||||
lazyNettyServerPropertiesDO.setInetPort(inetPort);
|
lazyNettyServerPropertiesDO.setInetPort(inetPort);
|
||||||
@ -62,6 +66,7 @@ public class NettyClientSocketApplicationListener implements ApplicationListener
|
|||||||
|
|
||||||
// 根据服务端端口、port 唯一性验证
|
// 根据服务端端口、port 唯一性验证
|
||||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||||
|
.eq(LazyNettyServerPropertiesDO::getServerId, serverId)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
||||||
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
||||||
|
@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
/**
|
/**
|
||||||
@ -21,6 +22,11 @@ import java.time.LocalDateTime;
|
|||||||
public class LazyNettyServerProperties {
|
public class LazyNettyServerProperties {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="namespace",example = "")
|
||||||
|
private String serverId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
|
@ -6,6 +6,7 @@ import lombok.experimental.Accessors;
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
import org.framework.lazy.cloud.network.heartbeat.client.config.PropertiesType;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.NettyClientStatus;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
import org.framework.lazy.cloud.network.heartbeat.common.enums.ProtocolType;
|
||||||
|
import org.wu.framework.core.NormalUsedString;
|
||||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTable;
|
import org.wu.framework.lazy.orm.core.stereotype.LazyTable;
|
||||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
|
import org.wu.framework.lazy.orm.core.stereotype.LazyTableField;
|
||||||
import org.wu.framework.lazy.orm.core.stereotype.LazyTableFieldId;
|
import org.wu.framework.lazy.orm.core.stereotype.LazyTableFieldId;
|
||||||
@ -25,6 +26,12 @@ import java.time.LocalDateTime;
|
|||||||
@Schema(title = "lazy_netty_server_properties",description = "服务端配置信息")
|
@Schema(title = "lazy_netty_server_properties",description = "服务端配置信息")
|
||||||
public class LazyNettyServerPropertiesDO {
|
public class LazyNettyServerPropertiesDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间
|
||||||
|
*/
|
||||||
|
@Schema(description ="命名空间",name ="serverId",example = "")
|
||||||
|
@LazyTableFieldUnique(name="server_id",comment="命名空间",columnType="varchar(25)",defaultValue = "DEFAULT")
|
||||||
|
private String serverId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -38,7 +45,7 @@ public class LazyNettyServerPropertiesDO {
|
|||||||
* 客户身份ID
|
* 客户身份ID
|
||||||
*/
|
*/
|
||||||
@Schema(description ="客户身份ID",name ="clientId",example = "")
|
@Schema(description ="客户身份ID",name ="clientId",example = "")
|
||||||
@LazyTableFieldUnique(name="client_id",comment="客户身份ID",columnType="varchar(255)")
|
@LazyTableFieldUnique(name="client_id",comment="客户身份ID",columnType="varchar(25)")
|
||||||
private String clientId;
|
private String clientId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,7 +70,7 @@ public class LazyNettyServerPropertiesDO {
|
|||||||
* 服务端host
|
* 服务端host
|
||||||
*/
|
*/
|
||||||
@Schema(description ="服务端host",name ="inetHost",example = "")
|
@Schema(description ="服务端host",name ="inetHost",example = "")
|
||||||
@LazyTableFieldUnique(name="inet_host",comment="服务端host",columnType="varchar(255)")
|
@LazyTableFieldUnique(name="inet_host",comment="服务端host",columnType="varchar(25)")
|
||||||
private String inetHost;
|
private String inetHost;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,22 +1,19 @@
|
|||||||
package org.framework.lazy.cloud.network.heartbeat.client.infrastructure.persistence;
|
package org.framework.lazy.cloud.network.heartbeat.client.infrastructure.persistence;
|
||||||
|
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerProperties;
|
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerProperties;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerPropertiesRepository;
|
import org.framework.lazy.cloud.network.heartbeat.client.domain.model.lazy.netty.server.properties.LazyNettyServerPropertiesRepository;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity.LazyNettyServerPropertiesDO;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.converter.LazyNettyServerPropertiesConverter;
|
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.converter.LazyNettyServerPropertiesConverter;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.client.infrastructure.entity.LazyNettyServerPropertiesDO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
||||||
import java.util.stream.Collectors;
|
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
||||||
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
import org.wu.framework.lazy.orm.database.lambda.stream.wrapper.LazyWrappers;
|
||||||
import org.wu.framework.web.response.Result;
|
import org.wu.framework.web.response.Result;
|
||||||
import org.wu.framework.web.response.ResultFactory;
|
import org.wu.framework.web.response.ResultFactory;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.wu.framework.lazy.orm.database.lambda.stream.lambda.LazyLambdaStream;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.wu.framework.lazy.orm.database.lambda.domain.LazyPage;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* describe 服务端配置信息
|
* describe 服务端配置信息
|
||||||
@ -43,6 +40,7 @@ public class LazyNettyServerPropertiesRepositoryImpl implements LazyNettyServerP
|
|||||||
@Override
|
@Override
|
||||||
public Result<LazyNettyServerProperties> story(LazyNettyServerProperties lazyNettyServerProperties) {
|
public Result<LazyNettyServerProperties> story(LazyNettyServerProperties lazyNettyServerProperties) {
|
||||||
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = LazyNettyServerPropertiesConverter.INSTANCE.fromLazyNettyServerProperties(lazyNettyServerProperties);
|
LazyNettyServerPropertiesDO lazyNettyServerPropertiesDO = LazyNettyServerPropertiesConverter.INSTANCE.fromLazyNettyServerProperties(lazyNettyServerProperties);
|
||||||
|
String serverId = lazyNettyServerPropertiesDO.getServerId();
|
||||||
String inetHost = lazyNettyServerPropertiesDO.getInetHost();
|
String inetHost = lazyNettyServerPropertiesDO.getInetHost();
|
||||||
Integer inetPort = lazyNettyServerPropertiesDO.getInetPort();
|
Integer inetPort = lazyNettyServerPropertiesDO.getInetPort();
|
||||||
String clientId = lazyNettyServerPropertiesDO.getClientId();
|
String clientId = lazyNettyServerPropertiesDO.getClientId();
|
||||||
@ -50,6 +48,7 @@ public class LazyNettyServerPropertiesRepositoryImpl implements LazyNettyServerP
|
|||||||
|
|
||||||
// 查询 ip、端口、客户端
|
// 查询 ip、端口、客户端
|
||||||
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
boolean exists = lazyLambdaStream.exists(LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||||
|
.eq(LazyNettyServerPropertiesDO::getServerId, serverId)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
||||||
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
||||||
@ -57,6 +56,7 @@ public class LazyNettyServerPropertiesRepositoryImpl implements LazyNettyServerP
|
|||||||
if (exists) {
|
if (exists) {
|
||||||
// 更新
|
// 更新
|
||||||
lazyLambdaStream.update(lazyNettyServerPropertiesDO, LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
lazyLambdaStream.update(lazyNettyServerPropertiesDO, LazyWrappers.<LazyNettyServerPropertiesDO>lambdaWrapper()
|
||||||
|
.eq(LazyNettyServerPropertiesDO::getServerId, serverId)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
.eq(LazyNettyServerPropertiesDO::getInetHost, inetHost)
|
||||||
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
.eq(LazyNettyServerPropertiesDO::getInetPort, inetPort)
|
||||||
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
.eq(LazyNettyServerPropertiesDO::getClientId, clientId)
|
||||||
|
@ -10,11 +10,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyClientSocket;
|
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.NettyClientSocket;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
|
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.event.ClientChangeEvent;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientFilter;
|
import org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.tcp.filter.NettyTcpClientFilter;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerContext;
|
import org.framework.lazy.cloud.network.heartbeat.common.NettyServerContext;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.HandleChannelTypeAdvanced;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
|
||||||
|
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -88,7 +88,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
|
|||||||
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
|
.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(1024 * 1024, 1024 * 1024 * 2))
|
||||||
.handler(new NettyTcpClientFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList), this))
|
.handler(new NettyTcpClientFilter(new ChannelTypeAdapter(handleChannelTypeAdvancedList), this))
|
||||||
;
|
;
|
||||||
log.info("use clientId:{} connect to server IP:{},server port :{}", clientId, inetHost, inetPort);
|
log.info("use clientId:{} connect to server serverId:{}, IP:{},server port :{}", clientId, serverId, inetHost, inetPort);
|
||||||
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
ChannelFuture future = bootstrap.connect(inetHost, inetPort);
|
||||||
// 客户端连接服务端的channel
|
// 客户端连接服务端的channel
|
||||||
Channel serviceChannel = future.channel();
|
Channel serviceChannel = future.channel();
|
||||||
@ -96,7 +96,7 @@ public class NettyTcpClientSocket implements NettyClientSocket {
|
|||||||
future.addListener((ChannelFutureListener) futureListener -> {
|
future.addListener((ChannelFutureListener) futureListener -> {
|
||||||
if (futureListener.isSuccess()) {
|
if (futureListener.isSuccess()) {
|
||||||
|
|
||||||
log.info("clientId:{},connect to server IP:{},server port :{} isSuccess ", clientId, inetHost, inetPort);
|
log.info("clientId:{},connect to serverId:{}, server IP:{},server port :{} isSuccess ", clientId, serverId, inetHost, inetPort);
|
||||||
// 告诉服务端这条连接是client的连接
|
// 告诉服务端这条连接是client的连接
|
||||||
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
NettyProxyMsg nettyMsg = new NettyProxyMsg();
|
||||||
nettyMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
|
nettyMsg.setType(TcpMessageType.TCP_REPORT_CLIENT_CONNECT_SUCCESS);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" href="./favicon.ico">
|
<link rel="icon" href="./favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Java 使用 Lazy ORM 网络穿透客户端!</title>
|
<title>Java 使用 Lazy ORM 网络穿透客户端!</title>
|
||||||
<script type="module" crossorigin src="./assets/index-DjZ671Nk.js"></script>
|
<script type="module" crossorigin src="./assets/index-Dx8CuNMY.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-BEQZ9T9z.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-BEQZ9T9z.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -4,15 +4,20 @@ spring:
|
|||||||
client:
|
client:
|
||||||
# inet-host: 124.222.48.62
|
# inet-host: 124.222.48.62
|
||||||
# inet-port: 30676
|
# inet-port: 30676
|
||||||
# inet-host: 124.222.152.160
|
inet-host: 124.222.152.160
|
||||||
# inet-port: 30560
|
inet-port: 30560
|
||||||
inet-host: 127.0.0.1
|
server-id: tencent
|
||||||
inet-port: 7001
|
# inet-host: 192.168.15.121
|
||||||
|
# inet-port: 7001
|
||||||
|
# server-id: win
|
||||||
|
# inet-host: 127.0.0.1
|
||||||
|
# inet-port: 7001
|
||||||
inet-path: wu-lazy-cloud-heartbeat-server
|
inet-path: wu-lazy-cloud-heartbeat-server
|
||||||
client-id: socks-local-proxy # 客户端ID
|
client-id: socks-local-proxy # 客户端ID
|
||||||
app-key: a4bf4415-25aa-4007-914b-31ec77d1292f
|
app-key: a4bf4415-25aa-4007-914b-31ec77d1292f
|
||||||
app-secret: 88e6d827-12e7-4a5d-93e0-92c04c2414bc
|
app-secret: 88e6d827-12e7-4a5d-93e0-92c04c2414bc
|
||||||
protocol-type: tcp
|
protocol-type: tcp
|
||||||
|
|
||||||
# inet-host: 124.222.48.62 # 服务端地址
|
# inet-host: 124.222.48.62 # 服务端地址
|
||||||
# inet-port: 30676 #服务端端口
|
# inet-port: 30676 #服务端端口
|
||||||
# # inet-path: wu-lazy-cloud-heartbeat-server
|
# # inet-path: wu-lazy-cloud-heartbeat-server
|
||||||
|
Reference in New Issue
Block a user