mirror of
https://gitee.com/wujiawei1207537021/wu-lazy-cloud-network.git
synced 2025-06-16 10:25:07 +08:00
[fix] 添加namespace
This commit is contained in:
@ -30,8 +30,8 @@ public class HttpClientProxyClientProxyTypeAdvanced extends AbstractHttpClientPr
|
||||
@Override
|
||||
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
|
||||
Channel channel = nettyChannelContext.channel();
|
||||
String targetPortString = nettyProxyMsg.getTargetPortString();
|
||||
String targetIpString = nettyProxyMsg.getTargetIpString();
|
||||
String targetPortString = nettyProxyMsg.targetPort();
|
||||
String targetIpString = nettyProxyMsg.targetIp();
|
||||
Bootstrap b = new Bootstrap();
|
||||
b.group(channel.eventLoop())
|
||||
.channel(NioSocketChannel.class)
|
||||
|
@ -29,8 +29,8 @@ public class HttpProtocolHandleChannelLocalProxyTypeAdvanced extends AbstractHtt
|
||||
*/
|
||||
@Override
|
||||
protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg nettyProxyMsg) {
|
||||
String targetPortString = nettyProxyMsg.getTargetPortString();
|
||||
String targetIpString = nettyProxyMsg.getTargetIpString();
|
||||
String targetPortString = nettyProxyMsg.targetPort();
|
||||
String targetIpString = nettyProxyMsg.targetIp();
|
||||
Bootstrap b = new Bootstrap();
|
||||
Channel channel = nettyChannelContext.channel();
|
||||
b.group(channel.eventLoop())
|
||||
|
@ -37,8 +37,8 @@ public class NettySocketProtocolHandleSocketLocalProxyTypeAdvanced
|
||||
Channel channel = nettySocketChannelContext.channel();
|
||||
ChannelHandlerContext channelHandlerContext = nettySocketChannelContext.channelHandlerContext();
|
||||
EventLoopGroup group = EventLoopGroupFactory.createClientWorkGroup();
|
||||
String host = nettyProxyMsg.getTargetIpString();
|
||||
Integer port = Integer.parseInt(nettyProxyMsg.getTargetPortString());
|
||||
String host = nettyProxyMsg.targetIp();
|
||||
Integer port = Integer.parseInt(nettyProxyMsg.targetPort());
|
||||
Bootstrap b = new Bootstrap();
|
||||
Socks5AddressType socks5AddressType = nettySocketChannelContext.getSocks5AddressType();
|
||||
|
||||
|
@ -83,11 +83,11 @@ public class NettyHttpProxyHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
|
||||
ProxyRoute route = RouteContext.getRoute(originHost, String.valueOf(originPort));
|
||||
|
||||
String namespace = route.getNamespace();
|
||||
proxyMsg.setVisitorId(visitorId);
|
||||
proxyMsg.setData(bytes);
|
||||
|
||||
|
||||
proxyMsg.setNamespace(namespace);
|
||||
|
||||
if(ObjectUtils.isEmpty(route)){
|
||||
// 本地代理
|
||||
|
@ -60,7 +60,8 @@ public class NettySocks5CommandRequestHandler extends SimpleChannelInboundHandle
|
||||
|
||||
proxyMsg.setVisitorId(visitorId);
|
||||
ProxyRoute route = RouteContext.getRoute(originHost, String.valueOf(originPort));
|
||||
|
||||
String namespace = route.getNamespace();
|
||||
proxyMsg.setNamespace(namespace);
|
||||
|
||||
|
||||
if(ObjectUtils.isEmpty(route)){
|
||||
|
@ -24,6 +24,10 @@ public class ClientProxyRoute implements ProxyRoute{
|
||||
* 虚拟端口
|
||||
*/
|
||||
private String virtualPort;
|
||||
/**
|
||||
* 命名空间
|
||||
*/
|
||||
private String namespace;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -6,6 +6,9 @@ package org.framework.lazy.cloud.network.heartbeat.protocol.route;
|
||||
public interface ProxyRoute {
|
||||
|
||||
|
||||
String getNamespace();
|
||||
|
||||
|
||||
String getVirtualIp();
|
||||
|
||||
|
||||
|
@ -9,6 +9,11 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ServerProxyRoute implements ProxyRoute {
|
||||
|
||||
|
||||
/**
|
||||
* 命名空间
|
||||
*/
|
||||
private String namespace;
|
||||
/**
|
||||
*
|
||||
* 服务端ip
|
||||
|
Reference in New Issue
Block a user