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:
@ -2,22 +2,26 @@ package org.framework.lazy.cloud.network.heartbeat.server.netty.flow.proxy;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.proxy.AbstractHandleChannelProxyFlowAdvanced;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.ChannelFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.advanced.flow.proxy.ChannelProxyFlow;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelFlowEnum;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelProtocolType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.common.enums.ChannelProxyType;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.properties.ServerNodeProperties;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyProxyFlowApplication;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.LazyVisitorPortFlowApplication;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.visitor.flow.LazyVisitorPortFlowStoryCommand;
|
||||
import org.framework.lazy.cloud.network.heartbeat.server.standalone.application.command.lazy.proxy.flow.LazyProxyFlowStoryCommand;
|
||||
|
||||
/**
|
||||
* 进口流量处理
|
||||
*/
|
||||
public class ServerHandlerInProxyFlowHandler extends AbstractHandleChannelProxyFlowAdvanced {
|
||||
private final LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication;
|
||||
private final LazyProxyFlowApplication lazyProxyFlowApplication;
|
||||
private final ServerNodeProperties serverNodeProperties;
|
||||
|
||||
public ServerHandlerInProxyFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
public ServerHandlerInProxyFlowHandler(LazyVisitorPortFlowApplication lazyVisitorPortFlowApplication, LazyProxyFlowApplication lazyProxyFlowApplication, ServerNodeProperties serverNodeProperties) {
|
||||
this.lazyVisitorPortFlowApplication = lazyVisitorPortFlowApplication;
|
||||
this.lazyProxyFlowApplication = lazyProxyFlowApplication;
|
||||
this.serverNodeProperties = serverNodeProperties;
|
||||
}
|
||||
|
||||
@ -45,15 +49,24 @@ public class ServerHandlerInProxyFlowHandler extends AbstractHandleChannelProxyF
|
||||
@Override
|
||||
protected void doHandler(Channel channel, ChannelProxyFlow channelProxyFlow) {
|
||||
String clientId = channelProxyFlow.clientId();
|
||||
String ip = channelProxyFlow.ip();
|
||||
Integer port = channelProxyFlow.port();
|
||||
Integer flow = channelProxyFlow.flow();
|
||||
ChannelProtocolType channelProtocolType = channelProxyFlow.channelProtocolType();
|
||||
ChannelProxyType channelProxyType = channelProxyFlow.channelProxyType();
|
||||
|
||||
// TODO
|
||||
// 进口流量处理
|
||||
LazyVisitorPortFlowStoryCommand visitorPortFlow = new LazyVisitorPortFlowStoryCommand();
|
||||
visitorPortFlow.setInFlow(flow);
|
||||
visitorPortFlow.setClientId(clientId);
|
||||
visitorPortFlow.setVisitorPort(port);
|
||||
visitorPortFlow.setIsDeleted(false);
|
||||
lazyVisitorPortFlowApplication.flowIncreaseStory(visitorPortFlow);
|
||||
LazyProxyFlowStoryCommand lazyProxyFlowStoryCommand = new LazyProxyFlowStoryCommand();
|
||||
lazyProxyFlowStoryCommand.setInFlow(flow);
|
||||
lazyProxyFlowStoryCommand.setClientId(clientId);
|
||||
lazyProxyFlowStoryCommand.setIp(ip);
|
||||
lazyProxyFlowStoryCommand.setPort(port);
|
||||
lazyProxyFlowStoryCommand.setProtocolType(channelProtocolType);
|
||||
lazyProxyFlowStoryCommand.setProxyType(channelProxyType);
|
||||
|
||||
lazyProxyFlowStoryCommand.setIsDeleted(false);
|
||||
lazyProxyFlowApplication.flowIncreaseStory(lazyProxyFlowStoryCommand);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user