mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 18:35:05 +08:00
【fix】 优化代理
This commit is contained in:
@ -7,6 +7,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -43,7 +44,7 @@ public class NettyHttpClientProxyClientProxyHandler extends SimpleChannelInbound
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(TcpMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyByteBuf;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
@ -28,7 +29,7 @@ public class NettyHttpClientProxyClientRealHandler extends SimpleChannelInboundH
|
||||
// 访客通信通道 上报服务端代理完成
|
||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(ctx.channel());
|
||||
NettyProxyMsg returnMessage = new NettyProxyMsg();
|
||||
returnMessage.setType(TcpMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_RESPONSE_);
|
||||
returnMessage.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_RESPONSE_);
|
||||
returnMessage.setVisitorId(visitorId);
|
||||
returnMessage.setClientId(clientId);
|
||||
returnMessage.setData(bytes);
|
||||
@ -50,7 +51,7 @@ public class NettyHttpClientProxyClientRealHandler extends SimpleChannelInboundH
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(TcpMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
@ -44,7 +45,7 @@ public class NettyHttpClientProxyClientTransferRealHandler extends SimpleChannel
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(TcpMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyByteBuf;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -28,7 +29,7 @@ public class NettyHttpServerProxyClientRealHandler extends SimpleChannelInboundH
|
||||
// 访客通信通道 上报服务端代理完成
|
||||
Channel nextChannel = ChannelAttributeKeyUtils.getNextChannel(ctx.channel());
|
||||
NettyProxyMsg returnMessage = new NettyProxyMsg();
|
||||
returnMessage.setType(TcpMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_RESPONSE_);
|
||||
returnMessage.setType(ProxyMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_RESPONSE_);
|
||||
returnMessage.setVisitorId(visitorId);
|
||||
returnMessage.setClientId(clientId);
|
||||
returnMessage.setData(bytes);
|
||||
@ -50,7 +51,7 @@ public class NettyHttpServerProxyClientRealHandler extends SimpleChannelInboundH
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(TcpMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setType(ProxyMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -44,7 +45,7 @@ public class NettyHttpServerProxyClientTransferRealHandler extends SimpleChannel
|
||||
if (nextChannel != null) {
|
||||
// 上报关闭这个客户端的访客通道
|
||||
NettyProxyMsg closeVisitorMsg = new NettyProxyMsg();
|
||||
closeVisitorMsg.setType(TcpMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setType(ProxyMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CLOSE_);
|
||||
closeVisitorMsg.setVisitorId(visitorId);
|
||||
nextChannel.writeAndFlush(closeVisitorMsg);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.config.NettyClientProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.NettyHttpClientProxyClient;
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.filter.NettyHttpClientProxyClientProxyFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
@ -69,7 +69,7 @@ public class NettyHttpClientProxyClientProxySocket {
|
||||
if (futureListener.isSuccess()) {
|
||||
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(TcpMessageType.HTTP_CLIENT_PROXY_CLIENT_TRANSFER_CONNECTION_REPORT_);
|
||||
nettyProxyMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CONNECTION_);
|
||||
// other clientId
|
||||
nettyProxyMsg.setClientId(targetClientId);
|
||||
nettyProxyMsg.setClientTargetIp(targetIp);
|
||||
|
@ -14,6 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||
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.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -141,7 +142,7 @@ public class NettyHttpClientProxyClientRealSocket {
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setClientTargetIp(clientTargetIp);
|
||||
nettyProxyMsg.setClientTargetPort(clientTargetPort);
|
||||
nettyProxyMsg.setType(TcpMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL_);
|
||||
nettyProxyMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL_);
|
||||
transferChannel.writeAndFlush(nettyProxyMsg);
|
||||
|
||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, realChannel);
|
||||
|
@ -11,7 +11,7 @@ import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.NettyH
|
||||
import org.framework.lazy.cloud.network.heartbeat.client.netty.proxy.http.filter.NettyHttpClientProxyServerProxyFilter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.adapter.ChannelTypeAdapter;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -72,7 +72,7 @@ public class NettyHttpClientProxyServerProxySocket {
|
||||
if (futureListener.isSuccess()) {
|
||||
|
||||
NettyProxyMsg nettyProxyMsg = new NettyProxyMsg();
|
||||
nettyProxyMsg.setType(TcpMessageType.HTTP_CLIENT_PROXY_SERVER_TRANSFER_REPORT_);
|
||||
nettyProxyMsg.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_SERVER_TRANSFER_);
|
||||
// other clientId
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
|
||||
|
@ -14,6 +14,7 @@ import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
|
||||
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.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
|
||||
@ -141,7 +142,7 @@ public class NettyHttpServerProxyClientRealSocket {
|
||||
nettyProxyMsg.setClientId(clientId);
|
||||
nettyProxyMsg.setClientTargetIp(clientTargetIp);
|
||||
nettyProxyMsg.setClientTargetPort(clientTargetPort);
|
||||
nettyProxyMsg.setType(TcpMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL_);
|
||||
nettyProxyMsg.setType(ProxyMessageType.HTTP_REPORT_SERVER_PROXY_CLIENT_TRANSFER_CHANNEL_INIT_SUCCESSFUL_);
|
||||
transferChannel.writeAndFlush(nettyProxyMsg);
|
||||
|
||||
ChannelAttributeKeyUtils.buildNextChannel(transferChannel, realChannel);
|
||||
|
Reference in New Issue
Block a user