mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 10:25:07 +08:00
【fix】 优化代理
This commit is contained in:
@ -9,7 +9,7 @@ import io.netty.handler.codec.http.FullHttpRequest;
|
||||
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.TcpMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.constant.ProxyMessageType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.utils.ChannelAttributeKeyUtils;
|
||||
import org.framework.lazy.cloud.network.heartbeat.protocol.route.ClientProxyRoute;
|
||||
import org.framework.lazy.cloud.network.heartbeat.protocol.route.ProxyRoute;
|
||||
@ -88,22 +88,22 @@ public class NettyHttpProxyHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
ProxyRoute route = RouteContext.getRoute(host, String.valueOf(port));
|
||||
if(ObjectUtils.isEmpty(route)){
|
||||
proxyMsg.setType(TcpMessageType.HTTP_LOCAL_PROXY);
|
||||
proxyMsg.setType(ProxyMessageType.HTTP_LOCAL_PROXY);
|
||||
}else {
|
||||
if(RouteType.LOCAL.equals(route.getRouteType())){
|
||||
proxyMsg.setType(TcpMessageType.HTTP_LOCAL_PROXY);
|
||||
proxyMsg.setType(ProxyMessageType.HTTP_LOCAL_PROXY);
|
||||
}else if (RouteType.CLIENT_PROXY_CLIENT.equals(route.getRouteType())){
|
||||
ClientProxyRoute clientProxyRoute= (ClientProxyRoute) route;
|
||||
String clientId = clientProxyRoute.getClientId();
|
||||
proxyMsg.setClientId(clientId);
|
||||
proxyMsg.setType(TcpMessageType.HTTP_CLIENT_PROXY_CLIENT_);
|
||||
proxyMsg.setType(ProxyMessageType.HTTP_CLIENT_PROXY_CLIENT_);
|
||||
}else if (RouteType.CLIENT_PROXY_SEVER.equals(route.getRouteType())){
|
||||
proxyMsg.setType(TcpMessageType.HTTP_CLIENT_PROXY_SERVER_);
|
||||
proxyMsg.setType(ProxyMessageType.HTTP_CLIENT_PROXY_SERVER_);
|
||||
}else if (RouteType.SERVER_PROXY_CLIENT.equals(route.getRouteType())){
|
||||
ClientProxyRoute clientProxyRoute= (ClientProxyRoute) route;
|
||||
String clientId = clientProxyRoute.getClientId();
|
||||
proxyMsg.setClientId(clientId);
|
||||
proxyMsg.setType(TcpMessageType.HTTP_SERVER_PROXY_CLIENT_);
|
||||
proxyMsg.setType(ProxyMessageType.HTTP_SERVER_PROXY_CLIENT_);
|
||||
}
|
||||
}
|
||||
channelTypeAdapter.handler(ctx.channel(), proxyMsg);
|
||||
@ -122,7 +122,7 @@ public class NettyHttpProxyHandler extends ChannelInboundHandlerAdapter {
|
||||
// close
|
||||
NettyProxyMsg closeMes=new NettyProxyMsg();
|
||||
closeMes.setVisitorId(visitorId);
|
||||
closeMes.setType(TcpMessageType.HTTP_CLIENT_PROXY_SERVER_TRANSFER_CLOSE_REPORT_);
|
||||
closeMes.setType(ProxyMessageType.HTTP_REPORT_CLIENT_PROXY_SERVER_TRANSFER_CLOSE_);
|
||||
nextChannel.writeAndFlush(closeMes);
|
||||
closeOnFlush(nextChannel);
|
||||
}
|
||||
|
Reference in New Issue
Block a user