Merge remote-tracking branch 'origin/dev'

This commit is contained in:
aoshiguchen
2023-07-04 21:48:05 +08:00
20 changed files with 156 additions and 65 deletions
+3
View File
@@ -84,6 +84,9 @@
<a href="https://gitee.com/zoo-plus" target="_blank">
<img src="assets/developer/zoo-plus.png" width="12%">
</a>
<a href="https://gitee.com/MetalXingxing" target="_blank">
<img src="assets/developer/metal.png" width="12%">
</a>
</p>
# ❤️ 感谢
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+10
View File
@@ -60,3 +60,13 @@ export function deletePortPool(id) {
}
})
}
export function deleteBatchPortPool(ids) {
return request({
url: '/port-pool/delete-batch',
method: 'post',
data: {
ids: ids
}
})
}
@@ -8,60 +8,68 @@
<el-button size="mini" @click="handleCancelClick">{{cancelText}}</el-button>
<el-button type="primary" size="mini" @click="handleCommitClick">{{okText}}</el-button>
</div>
<el-button slot="reference" :type="type" :size="size">{{buttonText}}</el-button>
<el-button slot="reference" :type="type" :size="size" :icon="icon" :disabled="disabled">{{buttonText}}</el-button>
</el-popover>
</template>
<script>
export default {
name: 'deleteButton',
props: {
width: {
type: Number,
default: 160
export default {
name: 'deleteButton',
props: {
width: {
type: Number,
default: 160
},
buttonText: {
type: String,
default: '删除'
},
type: {
type: String,
default: 'danger'
},
size: {
type: String,
default: 'mini'
},
icon: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
},
title: {
type: String,
default: '确定删除吗?'
},
okText: {
type: String,
default: '确定'
},
cancelText: {
type: String,
default: '取消'
}
},
buttonText: {
type: String,
default: '删除'
data() {
return {
visible: false
}
},
type: {
type: String,
default: 'danger'
},
size: {
type: String,
default: 'mini'
},
title: {
type: String,
default: '确定删除吗?'
},
okText: {
type: String,
default: '确定'
},
cancelText: {
type: String,
default: '取消'
}
},
data() {
return {
visible: false
}
},
methods: {
handleCancelClick() {
this.visible = false
this.$emit('handleCancelClick')
},
handleCommitClick() {
this.visible = false
this.$emit('handleCommitClick')
methods: {
handleCancelClick() {
this.visible = false
this.$emit('handleCancelClick')
},
handleCommitClick() {
this.visible = false
this.$emit('handleCommitClick')
}
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
+1
View File
@@ -101,6 +101,7 @@ export default {
publish: 'Publish',
draft: 'Draft',
delete: 'Delete',
deleteBatch: 'DeleteBatch',
cancel: 'Cancel',
confirm: 'Confirm',
portOrRange: 'example: 3306 or 1000-2000'
+1
View File
@@ -121,6 +121,7 @@ export default {
publish: '发布',
draft: '草稿',
delete: '删除',
deleteBatch: '批量删除',
cancel: '取 消',
confirm: '确 定',
userId: '用户ID',
@@ -143,7 +143,7 @@
</el-select>
</el-form-item>
<el-form-item :label="$t('服务端端口')" prop="serverPort">
<el-select style="width: 280px;" class="filter-item" v-model="temp.serverPort" placeholder="请选择">
<el-select style="width: 280px;" class="filter-item" v-model="temp.serverPort" placeholder="请选择" filterable>
<el-option v-for="item in serverPortList" :key="item.port" :label="item.port" :value="item.port">
</el-option>
</el-select>
@@ -6,10 +6,13 @@
</el-select>
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
<button-popover class="filter-item" style="margin-left: 10px;" size="medium" icon="el-icon-delete"
:buttonText="$t('table.deleteBatch')" :disabled="checkBoxData.length==0" @handleCommitClick="handleDeleteBatch" />
</div>
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
style="width: 100%">
style="width: 100%" @selection-change="onTableRowChange">
<el-table-column align="center" width="40" type="selection" />
<el-table-column align="center" :label="$t('table.id')" width="120">
<template slot-scope="scope">
<span>{{scope.row.id}}</span>
@@ -92,7 +95,7 @@
</template>
<script>
import { createPortPool, deletePortPool, fetchList, updateEnableStatus, updatePortPool } from '@/api/portPool'
import { createPortPool, deletePortPool, deleteBatchPortPool, fetchList, updateEnableStatus, updatePortPool } from '@/api/portPool'
import { portGroupList } from '@/api/portGroup'
import waves from '@/directive/waves' // 水波纹指令
import { parseTime } from '@/utils'
@@ -157,7 +160,8 @@ const calendarTypeOptions = [
rules: {
port: [{ required: true, message: '端口必填', trigger: 'blur' }]
},
downloadLoading: false
downloadLoading: false,
checkBoxData:[], //表单勾选的行
}
},
filters: {
@@ -320,6 +324,24 @@ const calendarTypeOptions = [
return v[j]
}
}))
},
onTableRowChange(val){ //表单勾选后赋值
this.checkBoxData = val
},
handleDeleteBatch(){ //批量删除操作
let ids = []
this.checkBoxData.forEach(item => {ids.push(item.id)})
deleteBatchPortPool(ids).then(response => {
if (response.data.code === 0) {
this.$notify({
title: '成功',
message: '删除成功',
type: 'success',
duration: 2000
})
this.getList()
}
})
}
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
<filtering>false</filtering>
<excludes>
<exclude>app-*.yml</exclude>
<exclude>app-dev.yml</exclude>
</excludes>
</resource>
</resources>
@@ -78,6 +78,9 @@ public class ProxyClientService {
@Override
public void initChannel(SocketChannel ch) throws Exception {
if (null != proxyConfig.getClient().getTransferLogEnable() && proxyConfig.getClient().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(RealServerChannelHandler.class));
}
ch.pipeline().addLast(new RealServerChannelHandler());
}
});
@@ -92,7 +95,9 @@ public class ProxyClientService {
if (proxyConfig.getClient().getSslEnable()) {
ch.pipeline().addLast(createSslHandler());
}
// ch.pipeline().addFirst(new LoggingHandler(ProxyClientService.class));
if (null != proxyConfig.getClient().getTransferLogEnable() && proxyConfig.getClient().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(ProxyChannelHandler.class));
}
ch.pipeline().addLast(new ProxyMessageDecoder(proxyConfig.getProtocol().getMaxFrameLength(),
proxyConfig.getProtocol().getLengthFieldOffset(), proxyConfig.getProtocol().getLengthFieldLength(),
proxyConfig.getProtocol().getLengthAdjustment(), proxyConfig.getProtocol().getInitialBytesToStrip()));
@@ -121,7 +126,7 @@ public class ProxyClientService {
ch.pipeline().addLast(createSslHandler());
}
if (null != proxyConfig.getClient().getTransferLogEnable() && proxyConfig.getClient().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(ProxyClientService.class));
ch.pipeline().addFirst(new LoggingHandler(CmdChannelHandler.class));
}
ch.pipeline().addLast(new ProxyMessageDecoder(proxyConfig.getProtocol().getMaxFrameLength(),
proxyConfig.getProtocol().getLengthFieldOffset(), proxyConfig.getProtocol().getLengthFieldLength(),
+1 -1
View File
@@ -70,7 +70,7 @@
<filtering>false</filtering>
<excludes>
<exclude>app-*.yml</exclude>
<exclude>app-dev.yml</exclude>
</excludes>
</resource>
</resources>
@@ -63,7 +63,7 @@ public class ProxyConfiguration implements LifecycleBean {
@Override
public void initChannel(SocketChannel ch) throws Exception {
if (null != proxyConfig.getServer().getTransferLogEnable() && proxyConfig.getServer().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(ProxyTunnelServer.class));
ch.pipeline().addFirst(new LoggingHandler(TcpVisitorChannelHandler.class));
}
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast(new TcpVisitorChannelHandler());
@@ -123,4 +123,14 @@ public class PortPoolController {
ParamCheckUtil.checkNotEmpty(req.getPortIdList(), "portIdList");
return portPoolService.updateGroup(req);
}
@Post
@Mapping("/delete-batch")
@Authorization(onlyAdmin = true)
public void deleteBatch(PortPoolDeleteBatchReq req) {
ParamCheckUtil.checkNotNull(req, "req");
ParamCheckUtil.checkNotNull(req.getIds(), "ids");
portPoolService.deleteBatch(req.getIds());
}
}
@@ -0,0 +1,14 @@
package org.dromara.neutrinoproxy.server.controller.req.system;
import lombok.Data;
import java.util.List;
/**
* @author: Metal
* @date: 2023/7/3
*/
@Data
public class PortPoolDeleteBatchReq {
private List<Integer> ids;
}
@@ -43,7 +43,7 @@ public class HttpProxy implements EventListener<AppLoadEndEvent> {
@Override
public void initChannel(SocketChannel ch) throws Exception {
if (null != proxyConfig.getServer().getTransferLogEnable() && proxyConfig.getServer().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(ProxyTunnelServer.class));
ch.pipeline().addFirst(new LoggingHandler(HttpProxy.class));
}
ch.pipeline().addFirst(new BytesMetricsHandler());
ch.pipeline().addLast(new HttpVisitorChannelHandler(proxyConfig.getServer().getDomainName()));
@@ -51,7 +51,7 @@ public class HttpsProxy implements EventListener<AppLoadEndEvent> {
@Override
public void initChannel(SocketChannel ch) throws Exception {
if (null != proxyConfig.getServer().getTransferLogEnable() && proxyConfig.getServer().getTransferLogEnable()) {
ch.pipeline().addFirst(new LoggingHandler(ProxyTunnelServer.class));
ch.pipeline().addFirst(new LoggingHandler(HttpsProxy.class));
}
ch.pipeline().addLast(createSslHandler());
ch.pipeline().addFirst(new BytesMetricsHandler());
@@ -179,4 +179,15 @@ public class PortPoolService {
LicenseDO licenseDO = licenseMapper.queryById(req.getLicenseId());
return portPoolMapper.getAvailablePortList(req.getLicenseId(), licenseDO.getUserId());
}
public void deleteBatch(List<Integer> ids) {
List<PortPoolDO> portPoolDOList = portPoolMapper.selectBatchIds(ids);
ParamCheckUtil.checkNotNull(portPoolDOList, ExceptionConstant.PORT_NOT_EXIST);
portPoolMapper.deleteBatchIds(ids);
// 更新visitorChannel
portPoolDOList.stream().forEach(portPoolDO -> {
visitorChannelService.updateVisitorChannelByPortPool(portPoolDO.getPort(), EnableStatusEnum.DISABLE.getStatus());
});
}
}
@@ -7,7 +7,7 @@ article: false
## 1、 部署服务端
### 1.1、 Docker一键部署
> 当前最新版本为1.8.4,下面的脚本中,可以使用:`registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:1.8.4` 指定版本安装,推荐使用`latest`直接安装最新版。
> 当前最新版本为1.8.5,下面的脚本中,可以使用:`registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy:1.8.5` 指定版本安装,推荐使用`latest`直接安装最新版。
#### 使用默认sqlite数据库
```shell
@@ -87,6 +87,11 @@ neutrino:
访问成功,至此首次完整的内网穿透体验完成。开源不易,请速至[Gitee仓库](https://gitee.com/dromara/neutrino-proxy)一键三连🤝
## 5、客户端Docker部署
> 因为一些原因,官方不推荐客户端使用Docker方式部署,但有不少朋友希望采用这种方式,因此从1.8.5版本开始维护了客户端镜像,版本号同服务端,也可使用`latest`直接安装最新版。
- 客户端镜像地址:registry.cn-hangzhou.aliyuncs.com/asgc/neutrino-proxy-client:latest
- 注意:客户端采用docker部署时,服务端端口映射客户端ip请不要配置127.0.0.1应该配置为容器访问宿主机的ip或者hostname,具体请自行百度
<!--
## 4.开发&调试
@@ -4,9 +4,8 @@ date: 2023-07-01 13:35:00
permalink: /pages/a00001/
---
# 1、客户端启动后连不上服务端,一直在重连
## 1.1、启动日志包含`not found license-key config`相关字样
## 1、客户端启动后连不上服务端,一直在重连
### 1.1、启动日志包含`not found license-key config`相关字样
出现这种情况,说明客户端没获取到配置的license,可按如下检查:
- 客户端是否有配置app.yml,app.yml中是否有配置`license-key`
- 客户端启动参数是否指定app.yml配置,若未指定客户端不会加载任何jar外部的配置文件
@@ -15,17 +14,17 @@ permalink: /pages/a00001/
- `java -jar -DLICENSE_KEY=xxxx -DSERVER_IP=x.x.x.x -DSERVER_PORT=9000 -DSSL_ENABLE=false neutrino-proxy-client.jar`
- `java -jar neutrino-proxy-client.jar serverIp=x.x.x.x serverPort=9000 sslEnable=false licenseKey=xxxx`
## 1.1、配置文件确定都已经配置,且启动参数正确指定了,但是没有出现`认证成功日志`
### 1.2、配置文件确定都已经配置,且启动参数正确指定了,但是没有出现`认证成功日志`
- 确认客户端配置的`server-ip`,必须是服务端所在机器的ip,且保证客户端所在机器能正常ping通
- 确认客户端配置的`server-port``ssl-enable`,默认情况应配置为9000、false或9002、true,除非服务端app.yml有改动隧道对外端口
- 确认服务端对外的9000、9002端口是否已经放开
- 服务端如果采用docker部署,需要确保容器的9000、9002端口映射到宿主机
# 2、关于中微子代理涉及的2类SSL证书
## 2.1、HTTPS证书
## 2、关于中微子代理涉及的2类SSL证书
### 2.1、HTTPS证书
该证书用于服务端支持HTTPS,若需要在服务端`app.yml`中配置即可
## 2.2、隧道SSL证书
### 2.2、隧道SSL证书
该证书用于对客户端-服务端之间的数据通信进行加密,因此客户端/服务端均需要配置该证书。可参考如下命令生成:
```
keytool -genkey -alias test1 -keyalg RSA -keysize 1024 -validity 3650 -keypass 123456 -storepass 123456 -keystore "./test.jks"
+3 -1
View File
@@ -41,4 +41,6 @@ npm run build:$env
#拷贝
cd ..
cp -rf ./neutrino-proxy-admin/dist $adminDeployDir/
cp -rf ./neutrino-proxy-admin/dist/ $giteePagesDir
cp -rf ./neutrino-proxy-admin/dist/ $giteePagesDir
cd $serverDeployDir
zip -r neutrino-proxy-admin.zip "neutrino-proxy-admin/"