|
|
|
@ -1,9 +1,9 @@ |
|
|
|
|
package org.fengfei.lanproxy.client.handlers; |
|
|
|
|
|
|
|
|
|
import org.fengfei.lanproxy.client.ClientChannelMannager; |
|
|
|
|
import org.fengfei.lanproxy.client.config.ClientConfig; |
|
|
|
|
import org.fengfei.lanproxy.client.listener.ChannelStatusListener; |
|
|
|
|
import org.fengfei.lanproxy.client.listener.ProxyChannelBorrowListener; |
|
|
|
|
import org.fengfei.lanproxy.common.Config; |
|
|
|
|
import org.fengfei.lanproxy.protocol.Constants; |
|
|
|
|
import org.fengfei.lanproxy.protocol.ProxyMessage; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
@ -40,6 +40,8 @@ public class ClientChannelHandler extends SimpleChannelInboundHandler<ProxyMessa |
|
|
|
|
*/ |
|
|
|
|
private ChannelStatusListener channelStatusListener; |
|
|
|
|
|
|
|
|
|
private ClientConfig config = ClientConfig.getInstance(); |
|
|
|
|
|
|
|
|
|
public ClientChannelHandler(Bootstrap bootstrap, Bootstrap proxyBootstrap, ChannelStatusListener channelStatusListener) { |
|
|
|
|
this.bootstrap = bootstrap; |
|
|
|
|
this.proxyBootstrap = proxyBootstrap; |
|
|
|
@ -114,7 +116,8 @@ public class ClientChannelHandler extends SimpleChannelInboundHandler<ProxyMessa |
|
|
|
|
// 远程绑定
|
|
|
|
|
ProxyMessage proxyMessage = new ProxyMessage(); |
|
|
|
|
proxyMessage.setType(ProxyMessage.TYPE_CONNECT); |
|
|
|
|
proxyMessage.setUri(userId + "@" + Config.getInstance().getStringValue("client.key")); |
|
|
|
|
|
|
|
|
|
proxyMessage.setUri(userId + "@" + config.getClient().getKey()); |
|
|
|
|
channel.writeAndFlush(proxyMessage); |
|
|
|
|
|
|
|
|
|
realServerChannel.config().setOption(ChannelOption.AUTO_READ, true); |
|
|
|
|