Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bb6a09ce2 | ||
|
|
3cf6bcbe6e | ||
|
|
8f9375152e | ||
|
|
501012d9bc | ||
|
|
f2b560fa1f | ||
|
|
2b95967820 |
@@ -50,12 +50,11 @@ export default {
|
|||||||
this.chartDom = document.getElementById(this.chartId)
|
this.chartDom = document.getElementById(this.chartId)
|
||||||
this.myChart = echarts.init(this.chartDom)
|
this.myChart = echarts.init(this.chartDom)
|
||||||
const seriesList = []
|
const seriesList = []
|
||||||
const legendList = []
|
|
||||||
this.data.list && this.data.list.forEach((item, index) => {
|
this.data.list && this.data.list.forEach((item, index) => {
|
||||||
seriesList.push({
|
seriesList.push({
|
||||||
name: item.name,
|
name: item.name,
|
||||||
type: 'line',
|
type: 'line',
|
||||||
stack: 'Total',
|
// stack: 'Total',
|
||||||
data: item.value,
|
data: item.value,
|
||||||
areaStyle: {
|
areaStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
@@ -74,7 +73,6 @@ export default {
|
|||||||
},
|
},
|
||||||
smooth: true
|
smooth: true
|
||||||
})
|
})
|
||||||
legendList.push(item.name)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
@@ -87,13 +85,13 @@ export default {
|
|||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
let title = this.data.text + '<br/>'
|
let title = this.data.text + '<br/>'
|
||||||
value.forEach(item => {
|
value.forEach(item => {
|
||||||
title = title + item.marker + item.seriesName + ' : ' + this.data.list[item.seriesIndex].label[item.dataIndex] + '<br/>'
|
title = title + item.marker + item.seriesName + ' : ' + getSizeDescByByteCount(item.data) + '<br/>'
|
||||||
})
|
})
|
||||||
return title
|
return title
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
data: legendList,
|
data: this.data.legendList,
|
||||||
left: 'right'
|
left: 'right'
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
|
|||||||
@@ -70,37 +70,19 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getChartData(last7dFlow) {
|
getChartData(last7dFlow) {
|
||||||
const title = []
|
|
||||||
const downFlowDesc = []
|
|
||||||
const totalFlowDesc = []
|
|
||||||
const upFlowDesc = []
|
|
||||||
last7dFlow.dataList.forEach(item => {
|
|
||||||
title.push(item.dateStr)
|
|
||||||
totalFlowDesc.push(item.totalFlowDesc)
|
|
||||||
downFlowDesc.push(item.downFlowDesc)
|
|
||||||
upFlowDesc.push(item.upFlowDesc)
|
|
||||||
})
|
|
||||||
const list = []
|
const list = []
|
||||||
last7dFlow.seriesList.forEach(item => {
|
last7dFlow.seriesList.forEach(item => {
|
||||||
let label = []
|
|
||||||
if (item.seriesName.indexOf('上') > -1) {
|
|
||||||
label = upFlowDesc
|
|
||||||
} else if (item.seriesName.indexOf('下') > -1) {
|
|
||||||
label = downFlowDesc
|
|
||||||
} else if (item.seriesName.indexOf('总') > -1) {
|
|
||||||
label = totalFlowDesc
|
|
||||||
}
|
|
||||||
list.push({
|
list.push({
|
||||||
name: item.seriesName,
|
name: item.seriesName,
|
||||||
value: item.seriesData,
|
value: item.seriesData
|
||||||
label: label
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
text: '流量监控',
|
text: '流量监控',
|
||||||
subtext: `最近${last7dFlow.dataList.length || 0}天流量监控`,
|
subtext: `最近${last7dFlow.dataList.length || 0}天流量监控`,
|
||||||
title: title,
|
title: last7dFlow.xDate,
|
||||||
list: list
|
list: list,
|
||||||
|
legendList: last7dFlow.legendData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -73,13 +73,15 @@ public class ClientChannelHandler extends SimpleChannelInboundHandler<ProxyMessa
|
|||||||
switch (event.state()) {
|
switch (event.state()) {
|
||||||
case READER_IDLE:
|
case READER_IDLE:
|
||||||
// 读超时,断开连接
|
// 读超时,断开连接
|
||||||
log.info("读超时");
|
// log.info("读超时");
|
||||||
ctx.channel().close();
|
// ctx.channel().close();
|
||||||
break;
|
break;
|
||||||
case WRITER_IDLE:
|
case WRITER_IDLE:
|
||||||
ctx.channel().writeAndFlush(ProxyMessage.buildHeartbeatMessage());
|
ctx.channel().writeAndFlush(ProxyMessage.buildHeartbeatMessage());
|
||||||
break;
|
break;
|
||||||
case ALL_IDLE:
|
case ALL_IDLE:
|
||||||
|
log.info("读写超时");
|
||||||
|
ctx.channel().close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ neutrino:
|
|||||||
initial-bytes-to-strip: 0
|
initial-bytes-to-strip: 0
|
||||||
length-adjustment: 0
|
length-adjustment: 0
|
||||||
read-idle-time: 40
|
read-idle-time: 40
|
||||||
write-idle-time: 8
|
write-idle-time: 5
|
||||||
all-idle-time-seconds: 0
|
all-idle-time-seconds: 45
|
||||||
client:
|
client:
|
||||||
thread-count: 50
|
thread-count: 50
|
||||||
key-store-password: ${STORE_PASS:123456}
|
key-store-password: ${STORE_PASS:123456}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<property name="LOG_FILE" value="/work/projects/neutrino-proxy-client/app.log"/>
|
<property name="LOG_FILE" value="./neutrino-proxy-client.log"/>
|
||||||
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{50} - %msg%n"/>
|
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{50} - %msg%n"/>
|
||||||
<!-- <property name="ENCODE" value="utf8" />-->
|
<!-- <property name="ENCODE" value="utf8" />-->
|
||||||
|
|
||||||
|
|||||||
+9
-8
@@ -71,19 +71,21 @@ public class ServerChannelHandler extends SimpleChannelInboundHandler<ProxyMessa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||||
Channel userChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
Channel visitorChannel = ctx.channel().attr(Constants.NEXT_CHANNEL).get();
|
||||||
if (userChannel != null && userChannel.isActive()) {
|
if (null != visitorChannel) {
|
||||||
Integer licenseId = ctx.channel().attr(Constants.LICENSE_ID).get();
|
Integer licenseId = ctx.channel().attr(Constants.LICENSE_ID).get();
|
||||||
String visitorId = ctx.channel().attr(Constants.VISITOR_ID).get();
|
String visitorId = ctx.channel().attr(Constants.VISITOR_ID).get();
|
||||||
Channel cmdChannel = ProxyUtil.getCmdChannelByLicenseId(licenseId);
|
Channel cmdChannel = ProxyUtil.getCmdChannelByLicenseId(licenseId);
|
||||||
|
|
||||||
if (cmdChannel != null) {
|
if (null != cmdChannel) {
|
||||||
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
ProxyUtil.removeVisitorChannelFromCmdChannel(cmdChannel, visitorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据发送完成后再关闭连接,解决http1.0数据传输问题
|
if (visitorChannel.isActive()) {
|
||||||
userChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
// 数据发送完成后再关闭连接,解决http1.0数据传输问题
|
||||||
userChannel.close();
|
visitorChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE);
|
||||||
|
visitorChannel.close();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CmdChannelAttachInfo cmdChannelAttachInfo = ProxyUtil.getAttachInfo(ctx.channel());
|
CmdChannelAttachInfo cmdChannelAttachInfo = ProxyUtil.getAttachInfo(ctx.channel());
|
||||||
if (null != cmdChannelAttachInfo) {
|
if (null != cmdChannelAttachInfo) {
|
||||||
@@ -96,8 +98,8 @@ public class ServerChannelHandler extends SimpleChannelInboundHandler<ProxyMessa
|
|||||||
.setCode(SuccessCodeEnum.SUCCESS.getCode())
|
.setCode(SuccessCodeEnum.SUCCESS.getCode())
|
||||||
.setCreateTime(new Date())
|
.setCreateTime(new Date())
|
||||||
);
|
);
|
||||||
|
ProxyUtil.removeCmdChannel(ctx.channel());
|
||||||
}
|
}
|
||||||
ProxyUtil.removeCmdChannel(ctx.channel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.channelInactive(ctx);
|
super.channelInactive(ctx);
|
||||||
@@ -122,7 +124,6 @@ public class ServerChannelHandler extends SimpleChannelInboundHandler<ProxyMessa
|
|||||||
ctx.channel().close();
|
ctx.channel().close();
|
||||||
break;
|
break;
|
||||||
case WRITER_IDLE:
|
case WRITER_IDLE:
|
||||||
log.info("写超时");
|
|
||||||
break;
|
break;
|
||||||
case ALL_IDLE:
|
case ALL_IDLE:
|
||||||
break;
|
break;
|
||||||
|
|||||||
+3
-4
@@ -91,8 +91,7 @@ public class VisitorChannelHandler extends SimpleChannelInboundHandler<ByteBuf>
|
|||||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||||
|
|
||||||
if (cmdChannel == null) {
|
if (null == cmdChannel) {
|
||||||
|
|
||||||
// 该端口还没有代理客户端
|
// 该端口还没有代理客户端
|
||||||
ctx.channel().close();
|
ctx.channel().close();
|
||||||
} else {
|
} else {
|
||||||
@@ -127,12 +126,12 @@ public class VisitorChannelHandler extends SimpleChannelInboundHandler<ByteBuf>
|
|||||||
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
InetSocketAddress sa = (InetSocketAddress) visitorChannel.localAddress();
|
||||||
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
Channel cmdChannel = ProxyUtil.getCmdChannelByServerPort(sa.getPort());
|
||||||
|
|
||||||
if (cmdChannel == null) {
|
if (null == cmdChannel) {
|
||||||
// 该端口还没有代理客户端
|
// 该端口还没有代理客户端
|
||||||
ctx.channel().close();
|
ctx.channel().close();
|
||||||
} else {
|
} else {
|
||||||
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
Channel proxyChannel = visitorChannel.attr(Constants.NEXT_CHANNEL).get();
|
||||||
if (proxyChannel != null) {
|
if (null != proxyChannel) {
|
||||||
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
|
proxyChannel.config().setOption(ChannelOption.AUTO_READ, visitorChannel.isWritable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ neutrino:
|
|||||||
initial-bytes-to-strip: 0
|
initial-bytes-to-strip: 0
|
||||||
length-adjustment: 0
|
length-adjustment: 0
|
||||||
read-idle-time: 40
|
read-idle-time: 40
|
||||||
write-idle-time: 10
|
write-idle-time: 5
|
||||||
all-idle-time-seconds: 0
|
all-idle-time-seconds: 0
|
||||||
server:
|
server:
|
||||||
boss-thread-count: 10
|
boss-thread-count: 10
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<property name="LOG_FILE" value="/work/projects/neutrino-proxy-server/app.log"/>
|
<property name="LOG_FILE" value="./neutrino-proxy-server.log"/>
|
||||||
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{50} - %msg%n"/>
|
<property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{50} - %msg%n"/>
|
||||||
<!-- <property name="ENCODE" value="utf8" />-->
|
<!-- <property name="ENCODE" value="utf8" />-->
|
||||||
|
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:latest
|
|||||||
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
|
- 在服务器上新建部署目录:`/work/projects/neutrino-proxy-server`
|
||||||
- 将` neutrino-proxy-server.jar`、`neutrino-proxy-admin.zip`上传至服务器部署目录。
|
- 将` neutrino-proxy-server.jar`、`neutrino-proxy-admin.zip`上传至服务器部署目录。
|
||||||
- 解压`neutrino-proxy-admin.zip`文件
|
- 解压`neutrino-proxy-admin.zip`文件
|
||||||
- 执行命令`java -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用sqlite数据库。
|
- 执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar`启动服务端完成部署,默认使用sqlite数据库。
|
||||||
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,文件内容同上。执行命令`java -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
|
- 若需要指定自己的mysql数据库,同样的需要在当前目录下新建`app.yml`文件,文件内容同上。执行命令`java -Dfile.encoding=utf-8 -jar neutrino-proxy-server.jar config=app.yml`启动服务端完成部署
|
||||||
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/bin/server_start.sh 使用shell脚本启动服务端。
|
- 可参照 https://gitee.com/dromara/neutrino-proxy/blob/master/bin/server_start.sh 使用shell脚本启动服务端。
|
||||||
|
|
||||||
## 2、管理后台配置
|
## 2、管理后台配置
|
||||||
|
|||||||
Reference in New Issue
Block a user